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!

Returning a default value in SQL when no rows found

cubmarJun 13 2008 — edited Oct 4 2013
Hi

How can change my SQL to return a default value if no rows are found?

Eg:
select text from text_file where criteria=met

If no rows are found, I would like text to contain '**Empty' for example


Thanks

Comments

I think you mean "odd numbered".
Anyway, here is an example:
select * from (select ename,job, ROWNUM AS rn from emp) where mod(rn, 2) <> 0;

1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 1 2013
Added on Jun 13 2008
19 comments
146,135 views