Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How temporary tables can be used in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Souvik Chanda

New User


Joined: 11 Oct 2007
Posts: 1
Location: Kolkata, India

PostPosted: Fri Oct 12, 2007 12:59 pm    Post subject: How temporary tables can be used in DB2
Reply with quote

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
View user's profile Send private message

ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri Oct 12, 2007 2:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Fri Oct 12, 2007 4:57 pm    Post subject:
Reply with quote

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
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Fri Oct 12, 2007 5:10 pm    Post subject:
Reply with quote

Make use of this link.

http://www.cs.newpaltz.edu/~pletcha/DB/db2_TempTables.html
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts To know activities on db2 tables ashek15 DB2 4 Fri Mar 03, 2017 11:23 pm
No new posts ERM-Diagram of SysIBM-Catalog-Tables Auryn DB2 2 Fri Feb 17, 2017 6:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us