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

Tryhackme OWASP Top 10 Walkthrough

5 No Code Creation Tools to Build Websites, Apps, and More

GTFO CTF

Learn cloud computing for free

DIY HyperDeck Studio Mini

Building your first REST API: Java and Spring Boot

All About B Trees and Database

ROCK@home — Installation (2/3)

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

SQL Part 6

Using the CASE Statement in SQL Server

How to create databases and tables?

Analysis of Starbucks offers

copyright:photosvit/169311955