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 assign a value of 'ALL' or NULL to a substitution variable

530678Apr 23 2009 — edited Apr 24 2009
Hi:

I need a query... which should able to assign a value or return all records when I assign a value of 'ALL' or NULL to a substitution variable.

for instance:

select *
from tab1
where &col = 'xyz';

then it should should return all the records which matches the condition of 'xyz' for col1

I also need this query return all records when I use the following:

select *
from tab1
where &col = 'ALL';

select *
from tab1
where &col = NULL <NO VALUE ENTERED>;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 22 2009
Added on Apr 23 2009
7 comments
1,237 views