I need to do multiple selection in the where clause
select * from BATS where REASON in case when :P12_REASON = 'Rejects' then ('online', 'offline') else '' end and case when :P12_REASON = 'accepted' then ('online', 'offline', 'written') else '' end and goings on.....
Advertisement
Answer
You need to rewrite the clause using AND
logic:
SELECT * FROM BATS WHERE (:P12_REASON = 'Rejects' AND REASON IN ('online', 'offline') OR :P12_REASON = 'accepted' AND REASON IN ('online', 'offline', 'written')) AND -- goings on...
Note the parentheses around this logic are necessary to avoid improper grouping with the logic following the AND
.