Previous Topic: SELECT StatementNext Topic: SELECT of a Table Procedure


SELECT of a Procedure

A procedure always returns zero or one result sets of parameters, therefore, a SELECT ... INTO is used.

EXEC SQL
     SELECT BONUS_AMOUNT,
            BONUS_CURRENCY
     FROM DEMOEMPL.GET_BONUS(1234)
          INTO :BONUS-AMOUNT,
               :BONUS_CURRENCY
END-EXEC

If the SELECT is successful, indicated by an SQLSTATE of '00000' the host variables BONUS-AMOUNT and BONUS-CURRENCY will contain valid data, returned by the invoked routine for EMP-ID 1234, the input value supplied for the first parameter.