Creating a temp-table layout plan
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
Creating a temp-table layout plan
You must define the temp-table layout in your application program to accommodate specific result sets before you attempt to populate the temp-tables with data. If a SQL statement retrieves more than one result set, you must define multiple temp-tables to be able to retrieve all the data. Therefore, the success of this approach depends to a large extent on your:
- Understanding of the specific data your foreign data source is providing you through a given stored procedure
- Ability to correctly define temp-tables
The following types of temp-tables can support result sets:
- Static — A temp-table whose schema is defined at compile time.
- Dynamic — A temp-table whose schema is defined at run time. There are two types of dynamic temp-tables: dynamic-prepared and dynamic-unprepared.
Keep
in mind that you can pass handles of temp-tables that contain a
mixed array. A mixed array is one in which some of
the temp-table handle elements can be static while others can be
dynamic. Also, note that a stored procedure supports the use of
an INT64 data type in static and dynamic temp tables
when the LOAD-RESULT-INTO phrase processes the
procedure's result set on the RUN-STORED-PROC statement.
The following table identifies the temp-table options for which you can plan and the requirements you must fulfill for each option.
| To return a result set to this type of temp-table . . . | Then the layout definition is . . . |
|---|---|
| StaticDynamic-prepared state | Defined by you; you must base the layout on the expected fields to be returned and each of these fields' data types so that the first field defined in the temp-table corresponds to the first column of the result set. This column matching and data type matching must be repeated successfully for each temp-table and its corresponding result set. |
| Dynamic - unprepared state | Not defined by you; the schema of the temp-table is based on the result-set schema and a mapping of default ABL data types for each SQL type. For more information, see Details about a dynamic temp-table in an unprepared state. |