字符串str在plsql的条件下

时间:2014-07-25 07:32:10

标签: sql plsql

早上好, 我在plsql中遇到问题,因为我必须拆分一个字符串,该字符串必须放在select的where条件中,如下例所示:

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 ;

但结果是:

ORA-01422: exact fetch returns more than requested number of rows

问题是如何将分割的字符串置于

的条件下
select T500DDT.T500DELIVERYCODE into x
from t500testadoc t500ddt
where T500DDT.T500DELIVERYCODE in (???)-- here there should be the splitted string 
group by  T500DDT.T500DELIVERYCODE ;

感谢您的帮助。

0 个答案:

没有答案