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))
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
Last modified date: 09/23/2025