In today’s article, we will be explaining on the topic of Create a Temporary tables, which provide a space to store and process data without cluttering main database structures.
– These are tables containing records specific to a session.
– Records are destroyed when the session is terminated.
– It is created using the “CREATE GLOBAL TEMPORARY TABLE” sentence.
– If “ON COMMIT PRESERVE ROWS” is used, the data is retained until the user terminates the session.
When the session is terminated, all data in the temporary table is deleted.
The data is only seen by the creating session. Other sessions cannot see it.
– By default it is “ON COMMIT DELETE ROWS”. At the end of the transaction, the data is deleted.
1 2 3 |
SQL> CREATE GLOBAL TEMPORARY TABLE ACCOUNT_TEMP ON COMMIT PRESERVE ROWS AS SELECT * FROM IPTVMWC.ACCOUNT; Table created. |