Previous Topic Next topic Print topic


Executing the SQL Statement CALL

Use the CALL statement to execute each series of SQL statements in your application.

Example 1

To call the stored procedure described in the topic How an Application Works with a Stored Procedure, your application might use this statement:

EXEC SQL
 CALL GETPRML(:V1, :V2);

If you use host variables in the CALL statement, you must declare them before using them.

Example 2

The example above is based on the assumption that none of the input parameters can have null values. To allow null values, code a statement like this:

EXEC SQL
 CALL GETPRML (:V1 :IV1, :V2 :IV2)

where :IV1 and :IV2 are indicator variables for the parameters.

Example 3

To use a host variable for the name of the stored procedure, code a statement like this:

EXEC SQL
 CALL :PROCNAME (:V1, :V2);

where :PROCNAME is the name of the stored procedure.

Previous Topic Next topic Print topic