oracle 10g case when in a where clause using a variable for the condition
Posted on 2011-05-06
I would like to evaluate on a variable that being passed to a stored procedure to determine which condition in the case when clause to perform.
The variable in this example is
vPrimary. If vPrimary = Y' get value where dept_id = 1 else get value where department_name like 'MERCHANT%'
I am not sure this is the correct construct because I have never used a case when in a where clause
where table1.emp_id = table2.emp_id
and case when vPrimary = 'Y'
dept_id = '1'
else department like 'MERCHANT%'