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
 
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 query to fetch record which has only ... maxsubrat DB2 10 Mon Dec 11, 2017 5:03 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Native SQL Query kishpra DB2 1 Wed Nov 22, 2017 8:38 pm
No new posts Query on IEFBR14 with GDG Ashishpanpaliya JCL & VSAM 4 Tue Nov 07, 2017 8:34 pm
No new posts Query on XMITIP abdulrafi All Other Mainframe Topics 1 Wed Oct 25, 2017 6:54 pm

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