IN statement from CASE result inside Where clause Oracle
<p>I have a sample of the table and problem I am trying to solve in Oracle.</p>

<pre><code>CREATE TABLE mytable (
id_field number
,status_code number
,desc1 varchar2(15)
);

INSERT INTO mytable  VALUES (1,240,'desc1');
INSERT INTO mytable  VALUES (2,242,'desc1');
INSERT INTO mytable  VALUES (3,241,'desc1');
INSERT INTO mytable  VALUES (4,244,'desc1');
INSERT INTO mytable  VALUES (5,240,'desc2');
INSERT INTO mytable  VALUES (6,242,'desc2');
INSERT INTO mytable  VALUES (7,245,'desc2');
INSERT INTO mytable  VALUES (8,246,'desc2');
INSERT INTO mytable  VALUES (9,246,'desc1');
INSERT INTO mytable  VALUES (10,242,'desc1');

commit;

SELECT *
FROM mytable
WHERE status_code IN CASE WHEN desc1 = 'desc1' THEN (240,242)
                          WHEN desc1 = 'desc2' THEN (240,245)
                            END
</code></pre>

<p>Basically I need to select a subset of status codes for each condition.
I could solve this with separate statements but the actual table I am doing this on has multiple descriptions and would result in around 20 unioned queries. </p>

<p>Any way to do this in one statement like I have attempted? </p>