Temp-table buffer methods and attributes
- Last Updated: January 22, 2026
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
|
DEFAULT-BUFFER-HANDLE. For example, you can create a second dynamic
buffer for the temp-table in the current example with these statements:
|
Now you have two dynamic buffers for the temp-table, one called CustSeq
that you get “for free” along with the temp-table definition and a second that you
created yourself.
The dynamic buffer methods that you learned about earlier are essential to using dynamic
temp-tables and their buffer. In particular, you will use the
BUFFER-CREATE() method on the buffer handle to create records in
the dynamic temp-table, BUFFER-DELETE() to delete them,
BUFFER-RELEASE() to release them, and
BUFFER-COPY() to copy fields from one or more database tables into
newly created records in the temp-table.
There are a couple of additional buffer methods and attributes specific to their association with temp-tables, however.
TABLE-HANDLE buffer attribute
TABLE-HANDLE attribute returns the handle of the
temp-table the buffer is associated with. For a buffer not associated with a
temp-table, it returns the Unknown value (?). Therefore, the
temp-table’s DEFAULT-BUFFER-HANDLE points to its default buffer,
and that buffer’s TABLE-HANDLE attribute points back to the
temp-table. In addition, the TABLE-HANDLE attribute of any other
buffer defined or created for the temp-table, such as CustSeq2,
also points back to the temp-table.
EMPTY-TEMP-TABLE buffer method
It is much more efficient to empty a temp-table in one statement rather than in a
FOR EACH loop. To empty a static temp-table you can use the
EMPTY TEMP-TABLE tt-name statement. With the
handle of a buffer for the temp-table, you can also use the EMPTY-TEMP-TABLE() method on the buffer. It takes no
arguments. Remember that while you can have multiple buffers associated with a
temp-table, just as you can with a database table, there is only one set of records
in the temp-table. The multiple buffers simply allow you to have pointers to
multiple different records in the temp-table at the same time. Thus, you can use the
EMPTY-TEMP-TABLE() method on any buffer for the temp-table and
the result is the same.