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
)
前台传来的字符串:'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
)