Examples

Example 1: Call procedure PGM1 and pass two parameters.

   CALL PGM1 (:hv1,:hv2)

Example 2: In C, invoke a procedure called SALARY_PROCED using the SQLDA named INOUT_SQLDA.

   struct sqlda *INOUT_SQLDA;
   
   /* Setup code for SQLDA variables goes here */
   
   CALL SALARY_PROC USING DESCRIPTOR :*INOUT_SQLDA;

Example 3: A Java(TM) procedure is defined in the database using the following statement:

  CREATE PROCEDURE PARTS_ON_HAND (IN  PARTNUM  INTEGER,
                                  OUT COST     DECIMAL(7,2),
                                  OUT QUANTITY INTEGER)
                   LANGUAGE JAVA PARAMETER STYLE JAVA
                   EXTERNAL NAME 'parts!onhand';

A Java application calls this procedure on the connection context 'ctx' using the following code fragment:

...
int        variable1;
BigDecimal variable2;
Integer    variable3;
...
#sql [ctx] {CALL PARTS_ON_HAND(:IN variable1, :OUT variable2, :OUT variable3)};
...

This application code fragment will invoke the Java method onhand in class parts since the procedure-name specified on the CALL statement is found in the database and has the external name 'parts!onhand'.