Additional temp-table examples
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
This section presents more examples that show various techniques to code temp-tables.
Executing a stored procedure call using the LOAD-RESULT-INTO phrase
This example shows the basics of executing a call to a stored procedure using the
functionality that the LOAD-RESULT-INTO phrase supports. Note that the code
works with the stored procedure in Example comparable to the way you can see it works with ABL
code.
|
Using an existing temp-table without the TEMP-TABLE-PREPARE ( ) method
This example shows the basics of using an existing dynamic temp-table without the
TEMP-TABLE-PREPARE () method. In this instance, the send-sql-statement
option is used rather than a predefined stored proc. In contrast, the third example code
that appears later in this section shows the same approach, but explicitly defines the
existing dynamic temp-table with the TEMP-TABLE-PREPARE() method.
|
Using an existing temp-table with the TEMP-TABLE-PREPARE ( ) method
This example shows the basics of using an existing dynamic temp-table with the
TEMP-TABLE-PREPARE() method.
|
Note these points as they relate to the above example:
- As a prerequisite for creating the code shown in the previous example, the developer would need to define the schema for the table.
- Once the temp-table schema begins preparation from the clear
state, the temp-table must be defined to the exact specifications
for the result sets as generated by the
RUN STORED-PROCstatement or send-sql-statement option. Otherwise, theRUN STORED-PROCwill end in failure. Also, note theTEMP-TABLE-PREPAREmust be called at the completion of the temp-table definition associated with the stored procedure results.
A stored procedure that uses the LOAD-RESULT-INTO phrase with a single temp table and the send-sql-statement option
This example shows the syntax for the stored procedure with the
LOAD-RESULT-INTO phrase with a single static temp-table and the
send-sql-statement option.
|
Using the PROC-STATUS phrase
This example shows the use of a PROC-STATUS phrase. The
PROC-STATUS phrase must be defined as part of the RUN
STORED-PROC statement because of the implicit CLOSE STORED-PROC
that is associated with the LOAD-RESULT-INTO phrase.
|
In this example, note that the PROC-STATUS phase does not need a
PROC-HANDLE phrase because it is retrieved using the RUN
STORED-PROC statement and not after this statement's execution as it typically is
used.
Executing a call to a stored function that returns a result set using the LOAD-RESULT-INTO phrase.
This example is a two-part example that shows the basics of executing a call to a stored
function that returns a result set using a cursor and the functionality that the
LOAD-RESULT-INTO phrase supports. The result set will be loaded into a
temp-table.
|
|