Was this helpful?
DECLARE GLOBAL TEMPORARY TABLE Examples
The following are DECLARE GLOBAL TEMPORARY TABLE statement examples:
1. Create a temporary table.
exec sql declare global temporary table
session.emps
(name char(20) , empno char(5))
on commit preserve rows
with norecovery;
2. Use a subselect to create a temporary table containing the names and employee numbers of the highest-rated employees.
exec sql declare global temporary table
    session.emps_to_promote
    as select name, empno from employees
    where rating >= 9
    on commit preserve rows
    with norecovery
Last modified date: 08/28/2024