Using Case Statement in Where Clause
Hello All,
I wish to conditionally use different columns for retrieving unique row. This will be dependent upon a parameter passed to the Function/Procedure.
The SQL framed looks as below:
+select *+
from Test_Table
where column_1 = <some_value>
and case when p_call_location = 'A' then column_2 like '%ABC%'
when p_call_location = 'B' then column_2 Not Like '%ABC%'
when p_call_location = 'C' then column_3 like '%EFG%'
when p_call_location = 'D' then column_3 like '%IJKL%'
END;
However, I am not sure if this works, as I am getting a Missing Right Paranthesis error. Major hinderance is the depedency on multiple columns, which would need to be referred for particular scenario.
Can somebody please help me with an example or a skeleton of how a query should be formed?
Appreciate an early reply!!!