Name
CALL Statement
Synopsis
The CALL statement invokes a stored procedure.
Platform |
Command |
DB2 |
Supported, with variations |
MySQL |
Not supported |
Oracle |
Supported, with variations |
PostgreSQL |
Not supported |
SQL Server |
Not supported |
SQL2003 Syntax
CALLprocedure_name
([parameter
[,...] ])
Keywords
- CALL
procedure_name
Specifies the stored procedure that you want to invoke. It must be a previously defined stored procedure that is available in the current user context (instance, database, schema, etc.).
- (
parameter
[,...] ) Provides values for each input parameter required by the stored procedure. Each parameter listed is required by the stored procedure in the same ordinal position. Thus, the fifth parameter listed would provide the value for the fifth argument required by the stored procedure. The parameters must be enclosed in parentheses and separated by commas. Note that the parentheses are required even if there are no parameter values (e.g., even if there are no parameter values, you must still use CALL( )). Strings should be in single quotes. If the stored procedure has only OUT parameters, place host variables or parameter markers within the parentheses.
Rules at a Glance
The CALL statement makes it easy to invoke a stored procedure. Simply provide the name of the stored procedure and include any parameters used by the stored procedure, enclosing them within parentheses.
This Oracle example creates a simple stored procedure, and then calls it:
CREATE PROCEDURE update_employee_salary ...
Get SQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.