300x250
1. 테이블 생성 후 테이블 정보 조회
- 조회 항목
-- TABLE 정보
SELECT DTCC.COMMENTS T_COMMENTS
, DTC.TABLE_NAME
, DTC.COLUMN_NAME
, CASE
WHEN DATA_TYPE IN ('VARCHAR','VARCHAR2','CHAR') THEN DATA_TYPE||'('|| CHAR_LENGTH||CASE WHEN CHAR_USED = 'B' THEN ' BYTE' WHEN CHAR_USED = 'C' THEN ' CHAR' ELSE '' END||')'
WHEN DATA_TYPE = 'NUMBER' AND DATA_PRECISION IS NOT NULL THEN DATA_TYPE||'('||DATA_PRECISION||','||DECODE(DATA_SCALE,0,'0',DATA_SCALE)||')'
ELSE DATA_TYPE
END DATA_TYPE
, NULLABLE
, DATA_DEFAULT
, DCC.COMMENTS C_COMMENTS
, CASE WHEN DCCC.CONSTRAINT_NAME IS NOT NULL THEN DC.CONSTRAINT_TYPE ELSE '' END CONSTRAINT_NAME
, DCCC.CONSTRAINT_NAME
, DCCC.COLUMN_NAME
, DCCC.POSITION
FROM DBA_TABLES DT
INNER JOIN DBA_TAB_COLUMNS DTC ON DT.OWNER = DTC.OWNER AND DT.TABLE_NAME = DTC.TABLE_NAME
LEFT OUTER JOIN DBA_TAB_COMMENTS DTCC ON DT.OWNER = DTCC.OWNER AND DT.TABLE_NAME = DTCC.TABLE_NAME
LEFT OUTER JOIN DBA_COL_COMMENTS DCC ON DTC.OWNER = DCC.OWNER AND DTC.TABLE_NAME = DCC.TABLE_NAME AND DTC.COLUMN_NAME = DCC.COLUMN_NAME
LEFT OUTER JOIN DBA_CONSTRAINTS DC ON DT.OWNER = DC.OWNER AND DT.TABLE_NAME = DC.TABLE_NAME AND CONSTRAINT_TYPE = 'P'
LEFT OUTER JOIN DBA_CONS_COLUMNS DCCC ON DC.OWNER = DCCC.OWNER AND DC.TABLE_NAME = DCCC.TABLE_NAME AND DC.CONSTRAINT_NAME = DCCC.CONSTRAINT_NAME AND DCC.COLUMN_NAME = DCCC.COLUMN_NAME
WHERE 1= 1
--AND DT.OWNER = 'KDEX'
AND DT.TABLE_NAME LIKE 'BOARD'
--AND DCC.COMMENTS LIKE '%%'
--AND DTCC.COMMENTS LIKE '%추천%'
ORDER BY DTC.TABLE_NAME, DTC.COLUMN_ID
;
테이블 정보 조회시 화면
반응형
'5. 데이터베이스 관리 > 5.1 ORACLE' 카테고리의 다른 글
6.1 ORA-01045 : user scott lacks create session privilege; logon denied (0) | 2024.10.08 |
---|---|
[ORACLE 5장] 인덱스 생성 및 관리 (0) | 2024.04.24 |
[ORACLE 4장] 테이블 생성 및 관리 (0) | 2024.03.08 |
[ORACLE 3장] 사용자 생성 및 수정 (0) | 2024.03.08 |
[ORACLE 2장] 프로파일 관리 (0) | 2024.03.07 |