How to return different statements in where clause ? (oracle) I mean:

CREATE OR REPLACE FUNCTION FUNCTION1(ID IN NUMBER) RETURN NUMBER
BEGIN
SELECT COLUMN1, COLUMN2, COLUMN3 FROM TABLE1
WHERE COLUMN1&lt;= Y AND (CASE WHEN ID &lt; X THEN COLUMN1&lt;COLUMN2 ELSE COLUMN2&gt;COLUMN3 END),
AND COLUMN 3 = XYZ;

RETURN SOMETHING.

END;


I know case statement does not return an expression but a value. How can i use some kind of "conditional statements" or something to return expressions ? I use to do it easily in mysql with "IF conditional" but i don't know how to do it in Oracle 11g.
EDIT: Does it work the same, not only for where statemen but for select ?
Just use grouped WHERE conditions:

WHERE COLUMN1&lt;= Y 
   AND ((ID &lt; X AND COLUMN1&lt;COLUMN2)
        OR(ID &gt;= X AND COLUMN2&gt;COLUMN3))
AND COLUMN 3 = XYZ;


Remember you really just want to get some boolean evaluations back here - as long as you can reduce your requirements to distinct sets of conditions you can put it into WHERE which will be plenty fast.

The time to use CASE is if you have overlapping criteria that you need to short circuit.