Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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
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    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

priya

Moderator


Joined: 24 Jul 2003
Posts: 568
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: 53
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
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 REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us