Name

CALL

Synopsis

The CALL statement invokes a stored procedure.

Vendor

Command

SQL Server

Not supported

MySQL

Not supported

Oracle

Supported

PostgreSQL

Supported

SQL99 Syntax and Description

CALL procedure_name [(parameter [,...n] )]

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. If the stored procedure has only OUT parameters, or has no parameters, empty parentheses may be included.

Tip

Microsoft SQL Server does not support the CALL statement. However, nearly identical functionality can be achieved using the EXECUTE statement. Refer to the vendor documentation for a full explanation of this SQL Server extension.

Oracle Syntax and Variations

CALL [schema.][{type_name | package_name}.]procedure_name@dblink 
[(parameter [,...n] )]
[INTO :variable_name [INDICATOR :indicator_name] ]

Oracle allows the CALL statement to invoke standalone stored procedures, functions, methods, as well as stored procedures and functions contained within a type or package. If the procedure or function resides in another database, simply declare the database via a dblink statement, stating where the object resides, as part of the CALL statement. dblink must refer to a previously created database link.

If the called routine is a function, Oracle requires the INTO clause. Conversely, INTO can be used only when invoking functions. The variable that will ...

Get SQL in a Nutshell 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.