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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts More than 1 Include criteria for sing... Roy Ware SYNCSORT 6 Wed Sep 13, 2017 11:45 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

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