CALL (PROCEDURE) statement

The CALL (PROCEDURE) statement invokes a procedure. A call to a procedure does not return any value.

When a procedure with definer's rights is called, the current default schema is set to the eponymously named schema of the definer. For example, if the defining user is called OWNER, the default schema will also be set to OWNER. The definer's rights include the right to set the current role to a role for which the definer has privileges. When the procedure is first invoked, no role is set; even if the invoker has set a current role, the procedure running with definer's rights has no current role set initially.

When a procedure with invoker's rights is called, the current default schema and current role are unchanged initially within the procedure. Similarly, if SQL authorization mode is not enabled, the current default schema is unchanged initially within the procedure.

When the call returns, any changes made inside the procedure to the default current schema (and current role, if relevant) are reset (popped).

For information about definer's rights, see EXTERNAL SECURITY.

Syntax

CALL procedureName ( [ expression [ , expression ]* ] )

Example

CREATE PROCEDURE SALES.TOTAL_REVENUE(IN S_MONTH INTEGER,
    IN S_YEAR INTEGER, OUT TOTAL DECIMAL(10,2))
    PARAMETER STYLE JAVA READS SQL DATA LANGUAGE JAVA EXTERNAL NAME 
    'com.example.sales.calculateRevenueByMonth';
CALL SALES.TOTAL_REVENUE(?,?,?);