DB2 SQL GLOBAL TEMPORARY TABLE

  1. As DECLARE GLOBAL TEMPORARY TABLE creates a table in QTEMP lib so
  • Other sessions cannot share it.
  • It does not appear in the system catalog.
  • When you end your session, the table rows are deleted, and the table is dropped.
  • For example, same as CREATE TABLE statement, You LIKE or AS clause can be used.
DECLARE GLOBAL TEMPORARY TABLE table-name
{column-definition(s) | LIKE base-table-name | AS subquery }
[GTT-options]
DECLARE GLOBAL TEMPORARY Table tempnewproj
(projname VARCHAR(24) , projsdate DATE, projedate DATE))
ON COMMIT PRESERVE ROWS
NOT LOGGED
ON ROLLBACK PRESERVE ROWS
WITH REPLACE
DECLARE GLOBAL TEMPORARY TABLE TEMP_EMPLOYEE LIKE EMPLOYEE

--

--

--

A programmer.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

9 gift ideas for developers

Part One: Deploy a Multi-Datacenter Apache Cassandra Cluster in Kubernetes

Javascript — How the Engine Compiles?

The Curious Collector (Part 2)

Why TextMate 2 is My Favorite Code Editor for Mac (Part II)

Fears of a novice programmer

Interplanetary git in Remix

SQL LeetCode: 185. Department Top Three Salaries

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sumit goyal

Sumit goyal

A programmer.

More from Medium

SELECT statement for SQL

SELECT statement for SQL

History of SQL

How to Improve ServiceNSW COVID Case Alerts

SQL — How your CS degree only scratches the surface