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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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