Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sql union-INTO clause

sk12345678Mar 3 2014 — edited Mar 4 2014

SQL help

if either of the queries in union returns a value, i want to mark status as closed. How do i put the INTO clause in this case because of two queries. Thanks

                                             BEGIN
                                                                      
                                                  SELECT  1

                                                   FROM   TableA ta
                                                  WHERE   tA.col1 =  13
                                                    AND   tA.col2 = '100'
                                                UNION
                                                  SELECT 1
                                                  FROM    TableA tb
                                                  WHERE   tb.col2 = 'y'
                                                    AND   tb.col3 =  -123
                                                    AND   tb.col4 IS NOT NULL;

                                                      status_cd := 'Closed';

                                             EXCEPTION
                                                   WHEN NO_DATA_FOUND THEN
                                                        status_cd := 'Unknown';     
                                                  
                                             END;

This post has been answered by Frank Kulash on Mar 3 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2014
Added on Mar 3 2014
5 comments
369 views