Temporary tables in Oracle can be divided into session-level temporary tables and transaction-level temporary tables.
The role of temporary tables: for large amounts of data we just need to query a subset of the result sets so that we can use temporal tables.
1. Session-Level staging table
A session-level temporary table is the data in a staging table that exists only during the session lifecycle, and when the user exits the end of the session, Oracle automatically clears the data from the staging table.
Create global temporary table AAA (ID number) on commit oreserve rows;
Insert into AAA values (100);
SELECT * from AAA;
This is when you open another session window to query again, the data in the table can not be queried.
2. Temporary tables at the transaction level
Create Global temporary table BBB (ID number) on commit delete rows;
INSERT into BBB values (200);
SELECT * from BBB;
When you perform a commit and rollback operation, the data in the table is not checked again.
Oracle creates temporary tables