The DB2 temporary table definition method is unfamiliar to many new users who are new to the DB2 database. The following describes how to define a temporary DB2 table for your reference.
1. The Temporary Table of DB2 needs to be created using the command Declare Temporary Table, and must be created on the Temporary Table space of the user;
2. When creating a database, DB2 does not create user temporary tablespaces by default. To use temporary tables, you must create user temporary tablespaces before creating temporary tables;
3. The temporary table mode is SESSION. sessions are SESSION-based and isolated between sessions. When the session ends, the data in the temporary table is deleted, and the temporary table is implicitly detached. The definition of a temporary table is not displayed in SYSCAT. TABLES.
;
4. By default, when the Commit command is executed, all records in the DB2 temporary table will be deleted. This can be controlled by specifying different parameters when creating the temporary table;
5. When the ROLLBACK command is run, the user's temporary table will be deleted;
The following is an example of the definition of a temporary DB2 table:
Declare global temporary table results
(
Recid varchar (32), -- id
Xxly varchar (100), -- Information Source
Lxdh varchar (32), -- contact number of the information source
Fkrq date -- feedback time
) On commit preserve rows with replace not logged;
Install DB2 in linux
Connect SQL SERVER to the DB2 database
Implementation of DB2 circular Query
Rollback of A DB2 partitioned Database
Implementation of DB2 partitioned Database Backup