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 we use union allowed in embedded SQL?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    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

jeyakanthan

New User


Joined: 18 May 2005
Posts: 12
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
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 cobol embedded sql MS_Developer COBOL Programming 7 Fri Oct 14, 2016 2:39 pm
No new posts Null Indicator value -2 means in Embe... deepak_shrivastava DB2 2 Wed Jan 06, 2016 10:27 pm
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm
No new posts Illegal use of keyword fetch. Token w... HABBIE DB2 2 Fri Aug 28, 2015 5:20 pm
No new posts Embedded programs / link'ed programs sivakumar.karthik CICS 5 Fri Jun 05, 2015 1:12 am

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