Using global temporary tables in batch explain
To provide declarations of global temporary tables by using the ddname GLOBDDN, follow these steps:
- The input should be a flat file with FB 80.
- Terminate each SQL statement with a semicolon.
- Include the declaration of global temporary tables and insert statements in the file.
- When you run a large workload, if the same GTT name is used across many PACKAGES with unique declarations specific to each PACKAGE, it is beneficial to provide package-specific declarations, as shown in the following figure.
Place the package-specific definitions at the bottom of the file, identified by –PKG/DBRM followed by the package name. You can use wildcards for PACKAGE versions.
DECLARE GLOBAL TEMPORARY TABLE TEMPI LIKE
SYSIBM.SYSTABLES ON COMMIT PRESERVE ROWS;
SELECT NAME FROM SYSIBM.SYSTABLES;
DECLARE GLOBAL TEMPORARY TABLE TEMP2 LIKE
SYSIBM.SYSTABLESPACE ON COMMIT PRESERVE ROWS;
DECLARE GLOBAL TEMPORARY TABLE TEMP3 LIKE
SYSIBM.SYSDATABASE ON COMMIT PRESERVE ROWS;
--PKG/DBRM GLOBPKG.%
DECLARE GLOBAL TEMPORARY TABLE TEMP4 LIKE
SYSIBM.SYSCOLUMNS ON COMMIT PRESERVE ROWS;
INSERT INTO TEMP4
SELECT * FROM
SYSIBM.SYSCOLUMNS;
WHERE NAME LIKE "WORK%';
--PKG/DBRM GLOBAYO.%
DECLARE GLOBAL TEMPORARY TABLE TEMPS LIKE
SYSIBM.SYSINDEXES ON COMMIT PRESERVE ROWS;
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*