Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
What is dynamic sql statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
anandkulkarni1

New User


Joined: 19 Sep 2005
Posts: 5

PostPosted: Mon Sep 19, 2005 8:40 pm    Post subject: What is dynamic sql statement
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
References
priya

Moderator


Joined: 24 Jul 2003
Posts: 624
Location: Bangalore

PostPosted: Tue Oct 04, 2005 12:45 pm    Post subject:
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    Post subject:
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: 49
Location: India, Chennai

PostPosted: Thu Oct 06, 2005 6:25 pm    Post subject: sample code for dynamic sql ?
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    Post subject: Re: What is dynamic sql statement
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1