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 Need Help - Varying List Select SQL q... NikhilGuptaGaya DB2 0 Mon Jun 25, 2018 9:04 pm
No new posts How to force a select query to abend neo4u DB2 7 Mon Apr 23, 2018 1:36 pm
No new posts How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am

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