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!

How to show 0 when where condition returns nothing?

syed haiderFeb 25 2019 — edited Feb 27 2019

I have a query in which WHERE clause returns nothing. Sysdate is 2/25/2019.

I still want to display '0' when nothing is returned. How could I do it? Thanks in advance!

with test1 as
(
select 1 col1
from dual
where sysdate > '26-feb-2019'
)
select nvl(col1,0) col1
from test1

Comments
Post Details
Added on Feb 25 2019
17 comments
5,092 views