Creating created temporary tables

If you need a permanent, sharable description of a table but need to store data only for the life of an application process, you can define and use a created temporary table.

About this task

Db2 does not log operations that it performs on created temporary tables; therefore, SQL statements that use created temporary tables can execute more efficiently. Each application process has its own instance of the created temporary table.

Procedure

To create a created temporary table:

Issue the CREATE GLOBAL TEMPORARY TABLE statement.

Example

Begin general-use programming interface information. The following statement defines a created temporary table that is named TEMPPROD.

CREATE GLOBAL TEMPORARY TABLE TEMPPROD
  (SERIALNO     CHAR(8)     NOT NULL,
   DESCRIPTION  VARCHAR(60) NOT NULL,
   MFGCOSTAMT   DECIMAL(8,2)        ,
   MFGDEPTNO    CHAR(3)             ,
   MARKUPPCT    SMALLINT            ,
   SALESDEPTNO  CHAR(3)             ,
   CURDATE      DATE        NOT NULL);

End general-use programming interface information.