Is global temporary table session specific?

Options
- Yes
- No


CORRECT ANSWER : Yes

Discussion Board
GLOBAL TEMPORARY TABLE

Yes, the global temporary table is session specific. Global temporary tables are types of database tables which can privately store data, persistently for a session or transaction. The data flushes out at defined instant automatically. They often find their application in the situations, where data fetch and passage is not possible in a single stretch.

Note that only table data is session specific, but physically table is available in all sessions.

Syntax:
CREATE GLOBAL TEMPORARY TABLE
(
[COLUMN DEFINTION]
) ON COMMIT [DELETE | PRESERVE] ROWS;

In the above syntax, ON COMMIT DELETE ROWS sets the life of the data contained by the table to a single TRANSACTION. The data is automatically flushed away after each COMMIT/ROLLBACK is executed. These are Transaction-specific Temporary tables.
On the other hand, ON COMMIT PRESERVE ROWS restricts the life of the data to a single SESSION. Data is preserved in the table for a session only. These are Session-specific Temporary tables.

Prajakta Pandit 02-9-2017 11:40 PM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement