Creating Declared Global Temporary Tables (DGTTs)
Declared Global Temporary Tables (also known as DGTTs) are used to store temporary results within an application. Because these tables are only used for temporary storage, they do not persist. They do not appear in the system catalog either. And because they don't persist, they can't be shared with other applications. When the application using this table terminates, any data in the table is deleted and the table is dropped.
Another key difference between DGTTs and regular tables is that the rows in a DGTT cannot be locked, as the temporary tables can't be shared among different applications. In this recipe, we will create a declared global temporary table.
Getting ready
To create a declared global temporary table, we need a user temporary table space.
To create a declared global temporary table, we need at least one of the following authorities/privileges:
USE
privilege onUSER TEMPORARY TABLE SPACE
DBADM
authoritySYSADM
authoritySYSCTRL...