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: 355
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 To get Non matching row after compari... vinu78 DB2 7 Fri Jan 05, 2018 5:43 pm
No new posts DB2 catalog tables Pavan kumar chauhan DB2 8 Thu Dec 21, 2017 6:32 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Selecting a row from multiple tables! Vignesh Sid DB2 2 Thu Oct 26, 2017 6:09 pm
No new posts Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am

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