This SQL tutorial explains how to create SQL LOCAL TEMPORARY tables with syntax and examples.
Description
SQL LOCAL TEMPORARY TABLES are distinct within modules and embedded SQL packages inside SQL sessions.
Syntax
The syntax for DECLARE LOCAL TEMPORARY TABLE in SQL is:
DECLARE LOCAL TEMPORARY TABLE table_name
( column1 datatype [ NULL | NOT NULL ],
column2 datatype [ NULL | NOT NULL ],
...
);
Parameters or Arguments
table_name The identify of the local temporary table that you want to create. column1, column2 The columns that you want to create in the neighborhood temporary table. Each column must have a datatype. The column both be defined as NULL or NOT NULL and if this price is left blank, the database assumes NULL as the default.
Example
Let’s seem at a SQL DECLARE LOCAL TEMPORARY TABLE example:
DECLARE LOCAL TEMPORARY TABLE suppliers_temp
( supplier_id int NOT NULL,
supplier_name char(50) NOT NULL,
contact_name char(50)
);
This instance would create a LOCAL TEMPORARY TABLE referred to as suppliers_temp.
Leave a Review