There's more...

You can also create volatile or other temporary tables using the following codes.

The code for the Volatile table is:

/*Create volatile table*/CREATE Volatile TABLE EMP_TBL_MULTI
(EMP_ID INTEGER ,
EMP_Name VARCHAR(20),
Sal INTEGER) 
primary index (EMP_ID)
on commit preserve rows;

The code for the GLOBAL TEMPORARY table is:

/*Global Temp table*/CREATE GLOBAL TEMPORARY  TABLE EMP_TBL_GLOBAL
(EMP_ID INTEGER ,
EMP_Name VARCHAR(20),
Sal INTEGER) 
primary index (EMP_ID)
on commit preserve rows;

on commit preserve rows is used to commit data. Temporary tables make use of user SPOOL space, and both the table definition and data is deleted once the user logs off their session.

Get Teradata Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.