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!

Case Statement Issue

798631Sep 15 2011 — edited Sep 16 2011
Hi All,
I need help figuring out a simple case statement. I need to add an OR condition to a couple of the statements and also have a condition that will return everyting. The first query works but lacks the OR condtion/statement. Any help is appreciated.

Select item_no
from item
where item_id =
case
when &p_item = '123' then '123'
when &p_item = '133' then '133'
when &p_item = '444' then '444'
end

How can i do the following?

Select item_no
from item
where item_id =
case
when &p_item = '123' then '123' or null
when &p_item = '133' then '133' or null
when &p_item = '444' then '444'
when &p_item = '999' then return all records
end
This post has been answered by Frank Kulash on Sep 15 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 14 2011
Added on Sep 15 2011
8 comments
143 views