Global temporary tables

Database
Fan

Global temporary tables

Hi everyone,
I am new to Teradata

I am trying to understand the usage of the Global temporary tables
For utilizing the GTT tables ,should we create a GTT table using the Create statement and then use it or can we use it during run time in a script like in

Insert into GTT_sample_table
Select col1,col2,col3,col4
from sample table
where (col1 = :condition)

by using the above code will the GTT be created dynamically and what if we wanted a multi set global temporary table

Any help would be appreciated

Thanks
Vik

Tags (1)
3 REPLIES
Junior Contributor

Re: Global temporary tables

When you create a GTT then you actually create a kind of *template*, which is persistent and visible within the Data Dictionary.
Thus a GTT is created only once.

By submitting an INSERT you materialize your personal *version* of that table, which is only visible within your current session and dropped automatically when you logoff.

When you need MULTISET you simply specify it:
CREATE MULTISET GLOBAL TEMPORARY TABLE....

Dieter
Fan

Re: Global temporary tables

Thanks Dieter ,i could actually get the hang of it by your explanation

vik
Enthusiast

Re: Global temporary tables

Thanks a lot