Good morning, I have a problem in plsql because I have to split a string which has to be put in a where condition of a select as in the following example:
str:='3118450,3118451,3118449,3118447,3118448';
select T500DDT.T500DELIVERYCODE into x
from t500testadoc t500ddt
where T500DDT.T500DELIVERYCODE in (select regexp_substr(replace(str, ' ', ''),'[^,]+', 1, level) from dual
connect by regexp_substr(replace(str, ' ', ''), '[^,]+', 1, level) is not null)
group by T500DDT.T500DELIVERYCODE ;
but The result is :
ORA-01422: exact fetch returns more than requested number of rows
The problem is how can I put the splitted string in the condition of where
select T500DDT.T500DELIVERYCODE into x
from t500testadoc t500ddt
where T500DDT.T500DELIVERYCODE in (???)-- here there should be the splitted string
group by T500DDT.T500DELIVERYCODE ;
Thanks for the help.