In where clause i have two option 1) status = ‘N’ and type = ‘1’ and 2) status = ‘Y’ and type = ‘1’ based on parameter I need execute one option:
where case when (carName = :P_PARAMETER) then status = 'N' and type = '1' else status = 'Y' and type = '1' end
After execute get error any solution for solve this problem or other method?
Advertisement
Answer
You need to rewrite the logic:
where type = '1' AND ((status = 'N' AND carName = :P_PARAMETER)) OR status = 'Y')