case statement in oracle where clause

Hi,

I need to use the following statement in the where clause
case
    when upper(&P_PARAM1)= 'REINSTATE' then (b.action like 'REINST%' or b.action like 'APPROV%')
    when upper(&P_PARAM1)= 'REMOVE' then (b.action like 'DEN%' or b.action like 'REMOVE%')
    end

how can i use it in a where clause in oracle?
cobbadminsupportAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sdstuberCommented:
don't use case   :)

where
(
  (upper(&P_PARAM1)= 'REINSTATE' and (b.action like 'REINST%' or b.action like 'APPROV%'))
or
   (upper(&P_PARAM1)= 'REMOVE' and (b.action like 'DEN%' or b.action like 'REMOVE%'))
)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sdstuberCommented:
I guess you "could" do something like this,  but I wouldn't

where
1 =
case
    when upper(&P_PARAM1)= 'REINSTATE' and (b.action like 'REINST%' or b.action like 'APPROV%') then 1
    when upper(&P_PARAM1)= 'REMOVE' and (b.action like 'DEN%' or b.action like 'REMOVE%') then 1
    end
0
cobbadminsupportAuthor Commented:
I get this error     ORA-00904: "REMOVE": invalid identifier
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

sdstuberCommented:
I don't know what your complete SQL statement looks like after substitution but I'll take a guess...

you probably aren't putting quotes around your substitution variable prior to substitution

upper(REMOVE)  is wrong unless you have a column or function called "REMOVE"

upper('REMOVE') is correct

try changing

upper(&P_PARAM1)
to
upper('&P_PARAM1')
0
awking00Commented:
Can you provide some sample data and the expected results for the relevant portion of your query?
0
cobbadminsupportAuthor Commented:
thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.