Created On:  09 December 2010

Problem:

How do you call a SQL stored procedure/function that returns a value to the program?

Resolution:

The result parameter can be specified in the SQL call as follows:

   EXEC SQL
      :myResult = CALL myFunction(namedParam=:paramValue)
   END-EXEC

Or you can specify an OUT parameter which will contain the value set in the stored procedure.

   EXEC SQL
      CALL getDept(:empName IN, :deptName OUT)
   END-EXEC
Incident #2491320