SELECT SUBSTR(A.COLUMN_NAME,1,15) AS COLUMN_NAME -- 컬럼명
, DECODE(B.CONSTRAINT_TYPE, 'P','PRIMARY KEY' ,
'U','UNIQUE KEY' ,
'C','CHECK OR NOT NULL',
'R','FOREIGN KEY' ) AS CONSTRAINT_TYPE -- 제약조건 TYPE
, A.CONSTRAINT_NAME AS CONSTRAINT_NAME -- 제약 조건 명
FROM USER_CONS_COLUMNS A
, USER_CONSTRAINTS B
WHERE A.TABLE_NAME = UPPER('AAC010TL')
AND A.TABLE_NAME = B.TABLE_NAME
AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
ORDER BY 1;
Oracle 관련2005. 9. 20. 15:56