当前位置: 代码迷 >> 综合 >> oracel 重要记事
  详细解决方案

oracel 重要记事

热度:91   发布时间:2023-12-08 02:36:53.0

--索引对应的列,一次性取出

CREATE OR REPLACE FUNCTION ZJW_C2L(IND IN VARCHAR2) RETURN VARCHAR2 IS
  RET_MSG VARCHAR2(1000);
BEGIN
  SELECT SUBSTR(MAX(SYS_CONNECT_BY_PATH(COLUMN_NAME, ',')), 2) AS COLUMN_NAME
    INTO RET_MSG
    FROM (SELECT C.COLUMN_NAME, ROWNUM AS RN
            FROM dba_IND_COLUMNS C  --USER_IND_COLUMNS
           WHERE C.INDEX_NAME = IND
           ORDER BY C.COLUMN_POSITION)
   START WITH RN = 1
  CONNECT BY RN - 1 = PRIOR RN;
  RETURN RET_MSG;
END ZJW_C2L ;