dynamic statement in where clause???
DeclanBMar 3 2010 — edited Mar 3 2010Hi all,
I am writing a procedure and the query will be different based on the input parameters.
I'm wondering how I can do this inside the where clause? simplified example
select *
from tableA a, tableB b
where a.id = b.id
/* if input parameter = 'abc' then */
and a.total = b.total
/* if input parameter = 'xyz' then */
and a.total != b.total
I was thinking case statement but from what i read it cannot be used in this situation
Thanks