Professional Documents
Culture Documents
Implementation
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.[1]
CALL procedure(...)
or
EXECUTE procedure(...)
Other uses
In some systems, stored procedures can be used to control
transaction management; in others, stored procedures run inside a
transaction such that transactions are effectively transparent to
them. Stored procedures can also be invoked from a database
trigger or a condition handler. For example, a stored procedure
may be triggered by an insert on a specific table, or update of a
specific field in a table, and the code inside the stored procedure
would be executed. Writing stored procedures as condition
handlers also allows database administrators to track errors in the
system with greater detail by using stored procedures to catch the
errors and record some audit information in the database or an
external resource like a file.
Disadvantages
Stored procedure languages are often vendor-specific.
Changing database vendors usually requires rewriting existing
stored procedures.
Stored procedure languages from different vendors have
different levels of sophistication.
References
1. ^ "Calling a stored procedure from your application". Retrieved 11
September 2019.
2. ^ "Chapter 11. SQL Procedure Language Guide". OpenLink documentation.
Retrieved 11 September 2019.