Try OpenEdge Now
skip to main content
DataServer for Oracle
RDBMS Stored Procedure Details : Interfacing with RDBMS stored procedures : Loading a result set into a temp-table : Details about a Dynamic temp-table in a prepared state
 
Details about a Dynamic temp-table in a prepared state
This example shows multiple dynamic temp-tables in a prepared state. It is based on the stored procedure code presented in which shows the basics of executing a call to a stored procedure that returns multiple result sets using the functionality that the LOAD-RESULT-INTO phrase supports. Each result set will be loaded into a separate temp-table.
Dynamic temp-tables shown in a prepared state
/* Second part of this example - ABL code */

DEFINE VARIABLE tt1      AS HANDLE NO-UNDO.
DEFINE VARIABLE tt2      AS HANDLE NO-UNDO.
DEFINE VARIABLE tt-array AS HANDLE NO-UNDO EXTENT 2.

CREATE TEMP-TABLE tt1.
tt1:ADD-NEW-FIELD("custnum", "integer").
tt1:ADD-NEW-FIELD("name", "character").
tt1:TEMP-TABLE-PREPARE("custx1").

CREATE TEMP-TABLE tt2.
tt2:ADD-NEW-FIELD("ordernum", "integer").
tt2:ADD-NEW-FIELD("order-date", "date").
tt2:TEMP-TABLE-PREPARE("ordx1").

ASSIGN tt-array[1] = tt1
       tt-array[2] = tt2.

RUN STORED-PROC pcustorder LOAD-RESULT-INTO tt-array
  (INPUT 10, OUTPUT 0, OUTPUT 0).