Oracle把逗号分割的字符串转换为可放入in的条件语句的字符数列

前台传来的字符串:'589,321'

SELECT
*
FROM TAB_A T1
WHERE  T1.CODE  IN (

SELECT REGEXP_SUBSTR('589,321','[^,]+', 1, LEVEL) FROM DUAL

CONNECT BY REGEXP_SUBSTR('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, LEVEL) IS NOT NULL

)

posted @ 2017-07-03 13:49  公子苏苏苏  阅读(6239)  评论(0编辑  收藏  举报