Examples—Declare Global Temporary Table Statement
To create a temporary table:
declare global temporary table
session.emps
(name char(20), empno char(5))
with location = (personnel),
[no]duplicates,
allocation=100,
extend=100;
To use a subselect to create a temporary table containing the names and employee numbers of the highest-rated employees.
declare global temporary table
session.emps_to_promote
as select name, empno from employees
where rating >= 9