Transaction specific table:
CREATE GLOBAL TEMPORARY TABLE T_TEMP (
column1 NUMBER,
column2 NUMBER
) ON COMMIT DELETE ROWS;
Session Specific table
CREATE GLOBAL TEMPORARY TABLE T_TEMP
(
column1 NUMBER,
column2 NUMBER
) ON COMMIT PRESERVE ROWS;
Features:Data in temporary tables is automatically deleted at the end of the database session,, no matter what happens.
If the TRUNCATE statement is carried out on a temporary table, only the session specific data is truncated. Other sessions are not affectd.
We can perform DDL commands like ALTER TABLE, DROP TABLE etc only when no session is currently bound to it. A session gets bound to a temporary table when an INSERT is performed on it. The session gets unbound by a TRUNCATE, at session termination, or by doing a COMMIT or ABORT for a transaction-specific temporary table.
No comments:
Post a Comment