Oracle Global Temporary Table

In other programming languages like Python and c++, you all might have studied the concept of Local and Global Variables. 

  1. Local Variable: are those that are accessed only within the block of code it is declared.
  2. Global Variable: are those to be called from anywhere throughout the code.

Similarly, we have the concept of Global Temporary Variable and Local Temporary Variable in SQL. Global Temporary Tables, once created, are accessed from any connection in that database. 

NOTE The Global Temporary Table automatically deletes if the connection into which it creates is closed.


Create Global temporary Table Table_name
    Column1 Datatype(size),
    Column2 Datatype(size),....

Global temporary Table is the keyword to create a Global temporary Table. Table_name is the name of the table that you want to create.

Global Temporary Table in Oracle Example

We want to create a Global Temporary Table named Subjects wherein we want to store the different names of Subjects. Follow the code below to do the same:

create global temporary table subjects
Name Varchar(20)


global temporary table oracle example

The above output shows that the Global Temporary Table named Subjects is created