SELECT SUBSTR(A.COLUMN_NAME,1,15) COLUMN_NAME,
DECODE(B.CONSTRAINT_TYPE,
'P','PRIMARY KEY',
'U','UNIQUE KEY',
'C','CHECK OR NOT NULL',
'R','FOREIGN KEY') CONSTRAINT_TYPE,
A.CONSTRAINT_NAME CONSTRAINT_NAME
FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B
WHERE A.TABLE_NAME = UPPER('&table_name')
AND A.TABLE_NAME = B.TABLE_NAME
AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
ORDER BY 1;
DECODE(B.CONSTRAINT_TYPE,
'P','PRIMARY KEY',
'U','UNIQUE KEY',
'C','CHECK OR NOT NULL',
'R','FOREIGN KEY') CONSTRAINT_TYPE,
A.CONSTRAINT_NAME CONSTRAINT_NAME
FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B
WHERE A.TABLE_NAME = UPPER('&table_name')
AND A.TABLE_NAME = B.TABLE_NAME
AND A.CONSTRAINT_NAME = B.CONSTRAINT_NAME
ORDER BY 1;
'프로그래밍 > DB' 카테고리의 다른 글
[oracle] ' 포함한 쿼리 (0) | 2010.04.09 |
---|---|
[oracle] select 문을 이용한 update (0) | 2010.03.08 |
[Toad] tab 간격 조정하기 (0) | 2010.02.02 |
[ORACLE] 특수문자 입력 (0) | 2009.10.21 |
[Oracle] Toad 단축키 (0) | 2009.08.22 |