select * from (select 'a' col1 from dual
union
select 'b' col1 from dual
union
select 'c' col1 from dual
union
select 'd' col1 from dual
union
select 'e' col1 from dual
union
select 'f' col1 from dual
)
where 1=1
--and col1 in (:p_col1)
AND ( ( Coalesce(NULL, :p_col1) IS NULL ) OR ( col1 IN ( :p_col1) ) )
If and col1 in (:p_col1) is used then when we select All, then nothing is printed instead of all the values.
Coalesce function returns the first non null value from its parameters
No comments:
Post a Comment