--索引对应的列,一次性取出
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 ;