CALL
The CALL statement allows you to invoke stored procedures.
Format 1
EXEC SQL [ AT Database ] CALL Procedure-Name ( [ Parameters ] ) [ INTO Host-Variable ] END-EXEC |
Format 2
EXEC SQL [ AT Database ] [ Host-Variable = ] CALL Procedure-Name ( [ Parameters ] ) END-EXEC |
Syntax Rules
1. Multiple parameters must be separated by commas.
2. Each parameter name might be followed by the parameter type. The type can be IN, OUT or INOUT.
General Rules
1. Database identifies the active connection that will execute the query and must be previously defined using a Format 4
DECLARE statement.
2. Only one destination Host-Variable is allowed. If the stored procedure returns multiple fields or multiple rows, rely on a cursor defined using a Format 1
DECLARE statement.
Examples
Call a Stored Procedure that updates values on a totals table (the logic of the update is DB Server based and stored)
exec sql call update_totals() end-exec |
Call a Stored Procedure with an input parameter and an output parameter, storing the result in a destination data item
exec sql call proc1(:p1 IN, :p2 OUT) into :exit-status end-exec |