View previous topic :: View next topic
|
Author |
Message |
Souvik Chanda
New User
Joined: 11 Oct 2007 Posts: 1 Location: Kolkata, India
|
|
|
|
Can anybody tell how temporary tables can be used? I would like to know all the necessary steps required to use DB2 temporary tables in a program. Which one is a better approach - using a created temp. table or a declared temp. table? Would be very very thankful if I get a detailed answer. |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
You can use array to load all the data of a table and u can use the same in the COBOL program. |
|
Back to top |
|
|
dr_te_z
New User
Joined: 08 Jun 2007 Posts: 71 Location: Zoetermeer, the Netherlands
|
|
|
|
At my site they always use "declared". Dunno why.
It works great, I'm using it more and more. Just
Code: |
EXEC SQL DROP TABLE SESSION.Q_TMP
END-EXEC
EXEC SQL DECLARE
GLOBAL TEMPORARY TABLE SESSION.Q_TMP
( THIS SMALLINT NOT NULL DEFAULT 9
, THAT CHAR (006) NOT NULL
, WHATEVER CHAR (004) NOT NULL) |
e.g. when you have a complex query where you need info from "outside DB2" just gather that info into such a table and include/join that in your query.
Be ware that DB2 will treat that whole query as dynamic SQL! (empty plan-table) |
|
Back to top |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
Back to top |
|
|
|