Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Can we use union allowed in embedded SQL?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
nerella_phanindra

New User


Joined: 07 Dec 2005
Posts: 1

PostPosted: Wed Dec 07, 2005 12:54 pm    Post subject: Can we use union allowed in embedded SQL?
Reply with quote

Is the using of the union allowed in embedded SQL?

If yes, in which host variable (ww-slct1 or ww-slct2) the value will be stored after the following embedded SQL runs or we shud use only one host variable.

EXEC SQL
SELECT DISTINCT 1
INTO :WW-SLCT1
FROM X
UNION
SELECT DISTINCT 1
INTO :WW-SLCT2
FROM Y
END-EXEC.
Back to top
View user's profile Send private message
References
jeyakanthan

New User


Joined: 18 May 2005
Posts: 13
Location: chennai

PostPosted: Wed Dec 07, 2005 6:06 pm    Post subject: Re: Can we use union allowed in embedded SQL?
Reply with quote

yes we can use union in embedded SQL.

Here if the union results in single row no problem the values moved into the

respective host variable.


But if the union results in more than one row then it will lead to error.

You can declare this sql statement as cursor in working storage section it can handle more than one row.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1