To declare a local temporary table.
DECLARE LOCAL TEMPORARY TABLE table-name
... ( { column-definition [ column-constraint ... ] |table-constraint }, ... )
... [ | ON COMMIT DELETE ROWS | ]
| ON COMMIT PRESERVE ROWS |
Embedded SQL, procedures, triggers, and batches.
Must have RESOURCE authority.
None.
The DECLARE LOCAL TEMPORARY TABLE statement declares a temporary table. See "CREATE TABLE statement" for definitions of column-definition, column-constraint, and table-constraint.
Declared local temporary tables within compound statements exist within the compound statement. (See "Using compound statements"). Otherwise, the declared local temporary table exists until the end of the connection.
By default, the rows of a temporary table are deleted on COMMIT.
1. EXEC SQL DECLARE LOCAL TEMPORARY TABLE MyTable (
number INT
);
BEGIN
DECLARE LOCAL TEMPORARY TABLE TempTab (
number INT
);
...
END