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

ADM-DATA attribute AFTER-TABLE attribute BEFORE-TABLE attribute
DATA-SOURCE-MODIFIED attribute DEFAULT-BUFFER-HANDLE attribute DYNAMIC attribute
ERROR attribute ERROR-STRING attribute HANDLE attribute
HAS-RECORDS attribute INSTANTIATING-PROCEDURE attribute MIN-SCHEMA-MARSHAL attribute
NAME attribute NAMESPACE-PREFIX attribute NAMESPACE-URI attribute
NO-SCHEMA-MARSHAL attribute NUM-REFERENCES attribute ORIGIN-HANDLE attribute
PREPARED attribute PRIMARY attribute PRIVATE-DATA attribute
REJECTED attribute SCHEMA-MARSHAL attribute SERIALIZE-NAME attribute
TRACKING-CHANGES attribute TYPE attribute UNDO attribute
UNIQUE-ID attribute XML-NODE-NAME attribute

Methods

ADD-FIELDS-FROM( ) method ADD-INDEX-FIELD( ) method
ADD-LIKE-FIELD( ) method ADD-LIKE-INDEX( ) method
ADD-NEW-FIELD( ) method ADD-NEW-INDEX( ) method
CLEAR( ) method (Temp-Table Object Handle) COPY-TEMP-TABLE( ) method
CREATE-LIKE( ) method CREATE-LIKE-SEQUENTIAL( ) method
EMPTY-TEMP-TABLE( ) method READ-JSON( ) method
READ-XML( ) method READ-XMLSCHEMA( ) method
TEMP-TABLE-PREPARE( ) method WRITE-JSON( ) method
WRITE-XML( ) method WRITE-XMLSCHEMA( ) method

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

  • The temp-table object has three states, CLEAR, UNPREPARED and PREPARED. The temp-table is in a CLEAR state either when the temp-table is first created or immediately after the CLEAR( ) method is applied. The temp-table is in an UNPREPARED state during the period after the first definitional method has been applied and before the TEMP-TABLE-PREPARE( ) method is applied. The temp-table is in a PREPARED state after the TEMP-TABLE-PREPARE( ) method has been applied.
  • The user can discern whether the temp-table is in an UNPREPARED or PREPARED state by using the PREPARED attribute.

See also

Buffer object handle, CREATE TEMP-TABLE statement, DEFINE TEMP-TABLE statement, ProDataSet object handle