Oracle 字符串转数组

 SELECT V.EMPLOYEE_NAME
  from USER.EMPLOYEES_V V
 WHERE to_char(V.EMPLOYEE_ID) in (WITH A AS (SELECT (SELECT R.REMARK_EMPS
                                                 FROM USER.INFO R
                                                WHERE R.RULE_ID = 4171/*得到字符转数组*/) A
                                         FROM DUAL)
  SELECT DECODE(B, 0, SUBSTR(A, C), SUBSTR(A, C, B - C))
    FROM (SELECT A, B, (LAG(B, 1, 0) OVER(ORDER BY LV)) + 1 C
      FROM (SELECT A, INSTR(A, ',', 1, LEVEL) B, LEVEL LV
              FROM A
            CONNECT BY LEVEL <=
                       (LENGTH(A) - LENGTH(REPLACE(A, ',', ''))) + 1)))

你可能感兴趣的:(数据库)