SELECT TABLE_OWNER,
TABLE_NAME,
INDEX_NAME,
UNIQUE_RULE,
LTRIM(SYS_CONNECT_BY_PATH(COLUMN_NAME,', '),', ') INDEX_COLUMN
FROM (
SELECT A.TABLE_OWNER,
A.TABLE_NAME,
A.INDEX_NAME,
B.UNIQUENESS UNIQUE_RULE,
A.COLUMN_POSITION POSISION,
A.COLUMN_NAME,
ROW_NUMBER() OVER(PARTITION BY A.TABLE_OWNER, A.TABLE_NAME, A.INDEX_NAME ORDER BY A.TABLE_OWNER, A.TABLE_NAME, A.INDEX_NAME, A.COLUMN_POSITION ) RNUM,
COUNT(*) OVER(PARTITION BY A.TABLE_OWNER, A.TABLE_NAME, A.INDEX_NAME) CNT
FROM DBA_IND_COLUMNS A,
DBA_INDEXES B
WHERE A.TABLE_OWNER = B.TABLE_OWNER
AND A.TABLE_NAME = B.TABLE_NAME
AND A.INDEX_NAME = B.INDEX_NAME
AND B.TABLE_OWNER IN ('SEMIHOW')
ORDER BY A.TABLE_OWNER, A.TABLE_NAME, A.INDEX_NAME, A.COLUMN_POSITION
)
WHERE LEVEL = CNT
CONNECT BY RNUM = PRIOR RNUM + 1
AND INDEX_NAME = PRIOR INDEX_NAME
AND TABLE_OWNER = PRIOR TABLE_OWNER
AND TABLE_NAME = PRIOR TABLE_NAME
ORDER BY TABLE_OWNER, TABLE_NAME, INDEX_NAME
출처 : http://www.dator.co.kr/data24hh/textyle/43735
테이블 별 사용량 확인 (0) | 2014.07.16 |
---|---|
칼럼 Comment (0) | 2014.04.03 |
테이블 용량 확인 및 레코드수 조회 쿼리 (0) | 2014.04.01 |
MSSQL 테이블 정보 쿼리(Comment 포함) (0) | 2014.04.01 |
특정일자의 주차와 주차시작일자 주차마지막 일자 구하기 (0) | 2014.03.05 |