전부터 테이블 정의서가 없어 고생한 적이 많았는데....
능통한 분의 도움을 받아 작성해놓은 쿼리문.
요즘은 이 쿼리를 사용하지 않길 바랄뿐이다.
하나하나 조회해서 정리하는 귀찬음이란....

=== v1.0 ===
select column_id
        , table_name
        , column_name
        , data_type ||'( '||data_precision||', '||data_scale||' )'
        , data_length
        , data_precision
        , data_scale
        , decode( nullable, 'Y', '', 'N', 'NOT NULL',  '')
   from USER_TAB_COLUMNS
where table_name = upper( 'TABLE_NAME' )
  order by column_id

=== v1.1 ===
select decode( a.column_id, '1' , a.table_name, '' ) as TableName
       , a.column_id as ID
       , a.column_name as ColumnName
       , b.comments as Comments
       , a.data_type ||'( '||a.data_precision||', '||a.data_scale||' )' as Types
       , a.data_length as Length
       , a.data_precision as Precision
       , a.data_scale as Scale
       , decode( a.nullable, 'Y', 'NULL', 'N', 'NOT NULL',  '') as NullYN
  from USER_TAB_COLUMNS a,
         ALL_COL_COMMENTS b
where a.table_name = upper( 'TABLE_NAME' )
 --and a.data_type = upper( 'Data_Type' )
    and a.table_name = b.table_name(+)
    and a.column_name = b.column_name(+)
  order by column_id

+ Recent posts