Описание тега stored-procedures
A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a proc, sproc, StoPro, StoredProc, or SP) are actually stored in the database data dictionary. Also, stored procedures are pre-compiled statements.
Typical uses for stored procedures include data validation (integrated into the database) or access control mechanisms. Furthermore, stored procedures are used to consolidate and centralize logic that was originally implemented in applications. Using stored procedure this centralized logic can be easily manage if it is changing frequently. Extensive or complex processing that requires the execution of several sql statements is moved into stored procedures, and all applications call the procedures. One can use nested stored procedures, by executing one stored procedure from within another.
Using stored procedures is also a part of the security management of database systems. Database administrators can restrict access to individual stored procedures, giving them ability to define very granular security if needed.
Stored procedures are similar to user-defined functions (UDFs). The major difference is that UDFs can be used like any other expression within SQL statements, whereas stored procedures must be invoked using the CALL statement.
Useful Resources