IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Insert with select in Dynamic SQL


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 1020
Location: India

PostPosted: Tue Dec 28, 2010 9:34 pm
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
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
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: 1020
Location: India

PostPosted: Tue Dec 28, 2010 10:05 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Insert system time/date (timestamp) u... DFSORT/ICETOOL 5
No new posts JCL Dynamic System Symbols JCL & VSAM 3
Search our Forums:

Back to Top