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
 

 

Can I include the SQL Query from a string

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
aavugari mayuri

New User


Joined: 15 Aug 2006
Posts: 10

PostPosted: Mon Sep 25, 2006 12:54 pm    Post subject: Can I include the SQL Query from a string
Reply with quote

hi all,
is this possible..

str='select * from tablename'

and

EXEC SQL
STR
END-EXEC.

instead of

EXEC SQL
SELECT * FROM TABLENAME
END-EXEC.

i'm new to mainframe world so may ask some weird qns..please bear with me..

mayuri
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Sep 25, 2006 12:59 pm    Post subject:
Reply with quote

What is your host language?

O.
Back to top
View user's profile Send private message
aavugari mayuri

New User


Joined: 15 Aug 2006
Posts: 10

PostPosted: Mon Sep 25, 2006 1:16 pm    Post subject: Re: sql query in a string
Reply with quote

host language is COBOL only
Back to top
View user's profile Send private message
anamikak

New User


Joined: 10 May 2006
Posts: 64
Location: Singapore

PostPosted: Mon Sep 25, 2006 1:40 pm    Post subject:
Reply with quote

If you want to construct a string to execute an SQL, you can do so using dynamic SQL. But to execute Fixed list dynamic SQL you will also need to declare a cursor the result set.Then prepare,fetch and close the cursor.

Anamika
Back to top
View user's profile Send private message
cj10

New User


Joined: 18 Sep 2006
Posts: 9

PostPosted: Mon Sep 25, 2006 3:58 pm    Post subject:
Reply with quote

In embedded SQL, such declarations are not possible.

Executable SQL statements must be placed between the EXEC SQL ......END-EXEC statements.


Corrections welcome !!!!!!


Thanks,
CJ.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Sep 25, 2006 10:39 pm    Post subject: Re: Can I include the SQL Query from a string
Reply with quote

Anamika is correct, chech the link below

6.1 Chapter 6-1. Coding dynamic SQL in application programs

Dave
Back to top
View user's profile Send private message
aavugari mayuri

New User


Joined: 15 Aug 2006
Posts: 10

PostPosted: Tue Sep 26, 2006 10:17 am    Post subject: Re: Can I include the SQL Query from a string
Reply with quote

hi all..
thanx for the inputs..it helped..
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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Omegamon for DB2 query ashek15 DB2 0 Wed Feb 15, 2017 11:25 am
No new posts Query on DB2 WLM stored procedures ashek15 DB2 8 Sun Feb 12, 2017 11:13 pm


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