How to pass a list of values to one Oracle Report parameter? How to pass a list of values to one Oracle Report parameter? oracle oracle

How to pass a list of values to one Oracle Report parameter?


There are two ways you could solve this in Oracle Reports. I would usually prefer option #1.

Option 1: use INSTR to compare the values

and (INSTR(','||:p_kod_urusan||',', ','||mhn.kod_urusan||',') > 0    or :p_kod_urusan is null)    

Option 2: use a lexical parameter

and (mhn.kod_urusan IN (&p_kod_urusan) or  :p_kod_urusan is null)

With option 2, you need to watch out for the SQL injection vulnerability, as well as a potential performance issue caused by hard parsing and multiple query plans.

I'm not sure why you're replacing the string '[^,]+' with a comma. I've assumed your parameter is already a comma-delimited list of values.