본문 바로가기
컴퓨터관련

Oracle 사용자 테이블과 컬럼 및 코멘트 구하는 쿼리

by 기록이답이다 2016. 1. 27.
반응형

오라클의 쿼리를 이용하여 사용자의 전체 테이블과 테이블의 컬럼 및 코멘트를 구하는 쿼리

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<p>     select
              a.table_name
            , lower(a.column_name) column_name
            , b.comments column_str
            , data_type
            , to_char(data_length) data_length
            , nullable
            , case when (a.column_name = c.column_name) then 'true' else 'false' end as is_pk
        from all_tab_columns a
            , user_col_comments b
            , user_ind_columns c
        where a.table_name = b.table_name
        and a.column_name = b.column_name
        and a.table_name = c.table_name(+)
        and a.column_name = c.column_name(+)
        and a.owner = 'ksw'
        and instr(a.table_name,'$') = 0
        order by table_name
</p>
반응형