Previous Next

Temp-table object handle
A handle to a temp-table object. A temp-table object handle corresponds to an underlying ABL temp-table, which can be static or dynamic. A static temp-table is one you define at compile time with the DEFINE TEMP-TABLE statement. A dynamic temp-table is one you create at run time with the CREATE TEMP-TABLE statement.
Syntax 
 
temp-table-handle [ :attribute | :method ]
temp-table-handle
An item of type HANDLE representing a handle to a temp-table object.
attribute
An attribute of the temp-table object.
method
A method of the temp-table object.
Attributes
 
Methods
 
Example 
The following code fragment demonstrates the creation, definition and use of a temp-table object:
 
DEFINE VARIABLE tth             AS HANDLE NO-UNDO.
DEFINE VARIABLE bh              AS HANDLE NO-UNDO.
DEFINE VARIABLE qh              AS HANDLE NO-UNDO.
DEFINE VARIABLE buf-cust-handle AS HANDLE NO-UNDO.
 
/* Get db table handle as usual */
buf-cust-handle = BUFFER Customer:HANDLE.
/* Create an "empty" undefined temp-table */
CREATE TEMP-TABLE tth.
/* Give it Customer’s fields and indexes */
tth:CREATE-LIKE(buf-cust-handle).
/* Give it a single extra field */
tth:ADD-NEW-FIELD("f1","integer").
/* No more fields or indexes will be added to custx */
tth:TEMP-TABLE-PREPARE("custx").
/* Get the buffer handle for the temp-table */
bh = tth:DEFAULT-BUFFER-HANDLE.
/* Populate the table from Customer table */
FOR EACH Customer NO-LOCK:
  bh:BUFFER-CREATE.
  bh:BUFFER-COPY(buf-cust-handle).
END.
/* Run a query to access it*/
CREATE QUERY qh.
qh:SET-BUFFERS(bh).
qh:QUERY-PREPARE("FOR EACH custx WHERE . . .").
. . .
Notes 
*
*
See also 
Buffer object handle, CREATE TEMP-TABLE statement, DEFINE TEMP-TABLE statement, ProDataSet object handle

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.