Local Temporary Tables

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

In Oracle, local temporary tables are distinct within modules. These tables are defined and scoped to the session in which you created it.

Declare local temporary table

Syntax

  1. DECLARE LOCAL TEMPORARY TABLE table_name  
  2. ( column1 datatype [ NULL | NOT NULL ],  
  3.   column2 datatype [ NULL | NOT NULL ],  
  4.   ...  
  5.   column_n datatype [ NULL | NOT NULL ]  
  6. );  

Parameters

table_name: The parameter table_name specifies the local temporary table that you want to create.

column1, column2,... column_ n: It specifies the column that you want create in the local temporary table. Every column must have a datatype and should be defined as NULL or NOTNULL. If the value is left blank, it is by default treated as NULL.