Contents IndexDECLARE CURSOR statement DEALLOCATE DESCRIPTOR statement

User's Guide
   Part VI. SQL Anywhere Reference
     Chapter 43. Watcom-SQL Statements
      DECLARE TEMPORARY TABLE statement

Function

To declare a local temporary table.

Syntax

     DECLARE LOCAL TEMPORARY TABLE table-name
          ... ( { column-definition [ column-constraint ... ] |table-constraint }, ... )
          ... [    | ON COMMIT DELETE ROWS | ]
              | ON COMMIT PRESERVE ROWS |

Usage

Embedded SQL, procedures, triggers, and batches.

Permissions

Must have RESOURCE authority.

Side effects

None.

See also

Description

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.

Embedded SQL Example

     1. EXEC SQL DECLARE LOCAL TEMPORARY TABLE MyTable (
             number INT
         );

Procedure/trigger Example

     BEGIN
         DECLARE LOCAL TEMPORARY TABLE TempTab (
                 number INT
         );
         ...
     END

Contents IndexDECLARE CURSOR statement DEALLOCATE DESCRIPTOR statement