IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can we use union allowed in embedded SQL?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nerella_phanindra

New User


Joined: 07 Dec 2005
Posts: 1

PostPosted: Wed Dec 07, 2005 12:54 pm
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
jeyakanthan

New User


Joined: 18 May 2005
Posts: 12
Location: chennai

PostPosted: Wed Dec 07, 2005 6:06 pm
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
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Is multiple program names allowed in ... PL/I & Assembler 1
No new posts cobol embedded sql COBOL Programming 7
No new posts Null Indicator value -2 means in Embe... DB2 2
No new posts [SQL0029] INTO clause missing from em... DB2 2
No new posts Illegal use of keyword fetch. Token w... DB2 2
Search our Forums:

Back to Top