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
 
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 WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm

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