아래 SQL를 사용하여 테이블에 기본적인 명세서를 확인
아래 SQL 내용중 owner명을 사용하는 환경에 맞추어 변경하여 적용
select
owner
, table_name
,(select comments from dba_tab_comments where owner = c.owner and table_name = c.table_name) tab_comments
, column_id
, column_name
,(select trim(regexp_replace(comments,'\|.*')) from dba_col_comments where owner = c.owner and table_name = c.table_name and column_name = c.column_name) col_comments
,(
select 'PK('||cc.position||')'
from dba_constraints p, dba_cons_columns cc
where p.constraint_type = 'P'
and p.owner = cc.owner
and p.constraint_name = cc.constraint_name
and p.table_name = cc.table_name
and p.owner = c.owner
and p.table_name = c.table_name
and cc.column_name = c.column_name
) as PK
, decode(nullable,'N','NN') nullable
, data_type
, case when data_type in ('VARCHAR2', 'CHAR', 'RAW')
then data_type||'('||data_length||')'
when data_type in ('DATE', 'CLOB', 'BLOB', 'LONG', 'LONG RAW', 'ROWID')
then data_type
when data_type = 'FLOAT'
then data_type||'('||data_precision||')'
when data_type = 'NUMBER'
then data_type||decode(data_precision,null,null,'('||data_precision||','||data_scale||')')
when data_type like 'TIMESTAMP%'
then data_type
else data_type
end data_type
-- , data_length
-- , data_precision
, nvl(data_precision, data_length) data_length
, data_scale
, data_default
from dba_tab_columns c
where owner in ('TEST')
and exists (select 1 from dba_tables t where t.owner=c.owner and t.table_name=c.table_name) -- view 제외
order by owner, table_name, column_id
;
'RDB > Oracle' 카테고리의 다른 글
ogg 18c - exclude 데이터 (0) | 2019.07.02 |
---|---|
[hint] pq_distribute (0) | 2019.06.18 |
oracle character set 변경 (0) | 2019.05.29 |
오라클 DB 패치 버전 (0) | 2019.04.24 |
oracle 제품 가격 (0) | 2019.04.11 |