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

What is dynamic sql statement


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
anandkulkarni1

New User


Joined: 19 Sep 2005
Posts: 5

PostPosted: Mon Sep 19, 2005 8:40 pm
Reply with quote

hi,

can somebody explain how does this dynamic cobol-sql works and how to use the cursor in the same.

anand.
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Tue Oct 04, 2005 12:45 pm
Reply with quote

If you know the SQL statements at bind time, it's static sql. Else it's dynamic sql.
Back to top
View user's profile Send private message
anandkulkarni1

New User


Joined: 19 Sep 2005
Posts: 5

PostPosted: Wed Oct 05, 2005 7:48 pm
Reply with quote

hi priya,

thanks for that but i need to know how to use cursor here.

anand.
Back to top
View user's profile Send private message
Rameshs

New User


Joined: 15 Jun 2005
Posts: 53
Location: India, Chennai

PostPosted: Thu Oct 06, 2005 6:25 pm
Reply with quote

hi priya,

Can you give me some example code for dynamic sql ?
Back to top
View user's profile Send private message
babes

New User


Joined: 18 Oct 2005
Posts: 1

PostPosted: Tue Oct 18, 2005 5:41 pm
Reply with quote

Dynamic sql statement is one which is known at run time.


you have four types of dynamic sql.

execute immediate
non-select dynamic sql
fixed select dynamic sql
varying select dynamic sql



EXECUTE IMMEDIATE

data division.
w-s-s.
10 ws-stg.
49 ws-stg-Len pic s9(4) comp.
49 ws-stg-text pic x(50).
procedure division.
main-para.
move +40 to ws-Len.
accept a.
exec sql execute immediate from :ws-stg end-exec.
stop run.

you can move any sql query depending upon your requirement .

but you can 't use SELECT for the first two types of dynamic sql
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 JCL Dynamic System Symbols JCL & VSAM 3
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts Dynamic file allocation using JCL JCL & VSAM 8
Search our Forums:

Back to Top