convert string to list to use IN function
Hi all,
I have a parameter that users can insert comma delimited text. For example p_num = (1,2,4,5)
in a query for the where clause I would like to filter it by p_num, However p_num is optional it maybe null, How do I get all rows to show if p_num is null?
I have this but only shows rows when I have a value in p_num
where
p_num_value in (SELECT
regexp_substr(:p_num, '[^,]+', 1, level)
FROM
dual
CONNECT BY
regexp_substr(:p_num, '[^,]+', 1, level) IS not NULL
)