Checking a parameter with multiple values
863607May 22 2011 — edited May 23 2011Hello,
I've been searching for answers on this forum but still cannot find an answer to my problem.
Is it possible to do a query like this:
Select table1.column_name
from tb_trn_test table1
IF &&1 IS NULL then table1.column_name in ('Good','Better','Best')
IF &&1 IS NOT NULL then table1.column_name in ('&1')
The &&1 parameter to be passed can be null or can have at least 2 values ('Good','Worst').
I tried to do this but I always get an error when the parameter contains more than 1 value.
Select table1.column_name
from tb_trn_test table1
where
*((((SELECT NVL('&&1',NULL) FROM DUAL) Is Null)*
AND (table1.column_name in ('Good','Better','Best')))
OR
*(((SELECT NVL('&&1',NULL) FROM DUAL) Is Not Null) AND (table1.column_name IN ('&1'))))*
Hope there's someone who could help.
Thanks.