Define temp-tables

To define a temp-table you use the DEFINE TEMP-TABLE statement. When defining a temp-table, you specify each field and index in the temp-table definition. You define each field as a specific data-type, as you would in a DEFINE VARIABLE statement. You use the BEFORE-TABLE keyword to specify a before-table. The before-table stores the original data from an updated record, when the data in the temp-table record is changed. To define a temp-table with specific fields and indexes, use the following syntax:

DEFINE TEMP-TABLE table-name [ NO-UNDO ] BEFORE-TABLE before-table-name     
  { FIELD field-name AS data-type }     
  [ INDEX index-name [ IS [ UNIQUE ] [ PRIMARY ] ] { index-field } ].

The following is an example of the DEFINE TEMP-TABLE statement:

DEFINE TEMP-TABLE ttOrder NO-UNDO BEFORE-TABLE bttOrder 
  FIELD OrderNum AS INTEGER
  FIELD OrderDate AS DATE
  FIELD ShipDate AS DATE
  FIELD PromiseDate AS DATE
  FIELD OrderTotal AS DECIMAL 
  INDEX OrderNum IS UNIQUE PRIMARY OrderNum.

See also

Static ProDataSet and its Data-Relations in Use ProDataSets