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 Query similar to NVL2

vijzMay 3 2018 — edited May 3 2018

-- These are demo tables

with pending(process_id)

as

(select 1 from dual union all

select 2 from dual union all

select 3 from dual union all

select 4 from dual union all

select 5 from dual),

salary(emp_id, salary)

as

(select 101, 100 from dual union all

select 202, 200 from dual union all

select 303, 300 from dual union all

select 404,400 from dual union all

select 505, 500 from dual)

NVL2( string1, value_if_not_null, value_if_null )

NVL2(select count(*) from pending, "pending processing, stop query processing further" , select * from salary )

We are looking for logic like below, It might /might not be done in SQL itself. But, looking for some ideas

  Select count(*)from pending is not null

       then Stop Further query processing

     else

         select * from salary -- continuing next set of SQL statements

This post has been answered by Frank Kulash on May 3 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 31 2018
Added on May 3 2018
10 comments
485 views