Try OpenEdge Now
skip to main content
ABL Essentials
Defining and Using Temp-tables : Using temp-tables in your application : Defining a temp-table
 

Defining a temp-table

You define a temp-table using the DEFINE TEMP-TABLE statement. There are two basic ways to define the fields and indexes in the table. You can make the temp-table LIKE some single database table (or even like another temp-table that you have already defined), which gives it all the fields and indexes from the other table, or you can define fields and indexes individually. You can also do both, so that in a single statement you can define a temp-table to be LIKE another table but also to have additional fields and indexes.
Here is the basic syntax for the DEFINE TEMP-TABLE statement:

Syntax

DEFINE TEMP-TABLE temp-table-name
  [ LIKE table-name[ USE-INDEX index-name[ AS PRIMARY ]] . . . ]
  [ LIKE-SEQUENTIAL table-name[ USE-INDEX index-name
      [ AS PRIMARY ]] . . . ]
  [ FIELD field-name{ AS data-type| LIKE field-name}
      [field-options]]
     ...
  [ INDEX index-name[ IS [ UNIQUE ][ PRIMARY ]]
     {index-field[ ASCENDING | DESCENDING ]} . . . ]
You can see a description of the entire statement in the online help or in OpenEdge Development: ABL Reference.
* Defining fields for the temp-table
* Defining indexes for the temp-table
* Temp-table scope
* Temp-table buffers