Oracle SQL - Global Temporary Table

Introduction

You can create a global temporary table to store temporary data during calculation.

You can use global temporary table to store some data in a table by doing a complex query against joined tables.

Then update the interim result and finally you drop the table.

Data in a global temporary table may last until the end of the transaction or until the end of the session.


CREATE GLOBAL TEMPORARY TABLE <table_name>
        (column specifications....)
      ON COMMIT { DELETE | PRESERVE } ROWS;

When you commit or rollback to end the transaction or exit the session, the data is removed, but the table definition remains in the data dictionary.