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!

Execute one or the other query based on the result

USER101Dec 9 2010 — edited Dec 9 2010
Hello All,

Is there anyway I can design this query to execute only one subquery based on the results returned.
select to_char((NEXT_CHANGE# - 1),9999999999999999) latest_change 
from v$archived_log 
where SEQUENCE# =(select nvl(min(SEQUENCE#),0) 
                               from v$archived_log 
                               where ARCHIVED='YES' 
                               and APPLIED='NO')

If the above subquery returns 0, then I would like to execute the query below. Is there any way to embed multiple queries like case conditions ?

select max(SEQUENCE#) 
                               from v$archived_log 
                               where ARCHIVED='YES' 
                               and APPLIED='YES'
Thanks

G

Edited by: USER101 on Dec 9, 2010 9:34 AM
This post has been answered by 818663 on Dec 9 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 6 2011
Added on Dec 9 2010
7 comments
441 views