November 18th, 2003, 04:49 AM
Using decode in IN clause
Does anyone know if I can use DECODE in an IN clause to do the following:
where code = (parm_value, NULL, code, parm_value)
In the parameter value I want to specify a list of values to compare against code.
I have tried putting brackets around parm_value but this doesn't work.
November 18th, 2003, 12:07 PM
I think you can use it , check out the follwoing example:
WHERE deptno in (90,40,decode(deotno,10,10,20))
November 19th, 2003, 03:34 AM
Thanks for that but I don't think its exactly what I want - I need to pass in a parameter which contains a list of values or it can be NULL. Where it contains a list of values I want all of them to be used for the IN CLAUSE
so if the parameter was (1, 2, 3, 4) the IN CLAUSE would check against all 4 values?