Purpose and table creation syntax of “Declared temporary table”

The declared temporary tables are also non-permanent tables but unlike created temporary tables they can be defined in the application program. The existence of a declared temporary table is limited to program execution. Since the declared temporary tables are created and deleted at the runtime, their entries are not stored into DB2 system table SYSIBM.SYSTABLES.

The declared temporary table can be defined in the program using DECLARE GLOBAL TEMPORARY TABLE statement. The advantage of a declared temporary table over a created temporary table is that we can add constraints and indexes in these tables.

Updated on: 12-Sep-2020


Kickstart Your Career

Get certified by completing the course

Get Started