Search

Loading

Creating (Declaring), Inserting data into DB2 temporary tables

Declaring (Creating)


DECLARE GLOBAL TEMPORARY TABLE
SESSION.EMP_TABLE
(EMPID INTEGER NOT NULL,
EMPNAME CHAR(20))
[ON COMMIT DELETE ROWS  | ON COMMIT PRESERVE ROWS]

Even if you do not give the qualifier SESSION, the table will be created as SESSION.EMP_TABLE. Temporary tables cannot be created with our own qualifier.

Inserting
INSERT INTO SESSION.EMP_TABLE VALUES(1,'KARTHIK')

Fetching
SELECT * FROM SESSION.EMP_TABLE
blog comments powered by Disqus

Includes

Related Posts with Thumbnails