Reference Manual
CHAPTER 9. SQL Statements
To declare a local temporary table.
DECLARE LOCAL TEMPORARY TABLE table-name
... ( { column-definition [ column-constraint ... ] | table-constraint }, ... )
... [ ON COMMIT { DELETE | PRESERVE } ROWS ]
None.
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.
SQL/92 Conforms to the SQL/92 standard.
Sybase Adaptive Server Enterprise does not support DECLARE TEMPORARY TABLE.
The following example illustrates how to declare a temporary table in Embedded SQL:
EXEC SQL DECLARE LOCAL TEMPORARY TABLE MyTable ( number INT );
The following example illustrates how to declare a temporary table in a stored procedure:
BEGIN DECLARE LOCAL TEMPORARY TABLE TempTab ( number INT ); ... END