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

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 on 2017-11-23 10:15  小人物的奋斗  阅读(4472)  评论(0编辑  收藏  举报

导航