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
 
Insert with select in Dynamic SQL

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

New User


Joined: 28 Dec 2010
Posts: 2
Location: India

PostPosted: Tue Dec 28, 2010 6:10 pm    Post subject: Insert with select in Dynamic SQL
Reply with quote

Hi ,
I have two questions regarding Dynamic SQL
1) Can Insert with Select be done with my Dynamic SQL?If so can you please help me in doing it
Example:
Insert Into tableb
values(from_acct_seq,to_acct_seq)
select from_acct_seq from acct_actv
Where
Date= current-date
2) Are there any performance implications
Back to top
View user's profile Send private message

sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Tue Dec 28, 2010 9:34 pm    Post subject:
Reply with quote

Karthik,

Quote:
1) Can Insert with Select be done with my Dynamic SQL?If so can you please help me in doing it
Example:
Insert Into tableb
values(from_acct_seq,to_acct_seq)
select from_acct_seq from acct_actv
Where
Date= current-date

Yes. You can use SPUFI
Quote:
2) Are there any performance implications

It Depends( no. of row available on table & is there an index on the date column)

Welcome to IBMMAINFRAMES!

You have to be more elaborate...... the information you specified is not enough.

Why Dynamic SQL ?

Why do you think there will be some performance problem ?


Thanks,
Sushanth
Back to top
View user's profile Send private message
Karthikkumargk

New User


Joined: 28 Dec 2010
Posts: 2
Location: India

PostPosted: Tue Dec 28, 2010 9:40 pm    Post subject:
Reply with quote

Hi Sushant,

Thru Spufi its is feasible.
Application requires Dynamic SQL.
My query is can we use that sort of insert in Dynamic SQL.If so can you provide some sample code for the above insert
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Tue Dec 28, 2010 9:54 pm    Post subject:
Reply with quote

If you can successfully code and execute your SQL thru SPUFI - then you should be able to prepare and execute that same SQL dynamically in an application program - assuming that you have sufficient authority to do so.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Tue Dec 28, 2010 10:05 pm    Post subject:
Reply with quote

Karthik,

You can sample COBOL code for dynamic programming in DB2 V9 Application Programming & SQL Guide - Search for "Sample COBOL dynamic SQL program".

Thanks,
Sushanth
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 How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm

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