I need to write a sql for a prompt in a reporting tool. I get the list of multiple values in a variable separated by ‘-‘ and the number of such values can vary.(eg1.”abc-def” eg2.”abc-def-xyz”).
Now I need to write sql in oracle of this form(logically)
select something
from somewhere
where someColumn in 'abc' -- use substr to extract abc
or someColumn in 'def' -- use substr to extract def
or ...till we don't find '-'.
I can’t use plsql for the query. Either I may not be knowing to use the variable in which I select into in plsql or may be the reporting tool doesn’t support that.
Thanks in advance.
Try
To generalize (considering your fields are separated by “-“)
Basically the output of the subquery is shown below –