2009年10月7日水曜日

Oracleでテーブル構造を参照したいときのSQL

select t.table_name, t.column_name,
         data_type, data_length,
         data_precision, data_scale,
         decode(nullable,'Y','○',''), data_default, comments
from user_tab_columns t,
       user_col_comments c,
       user_tables ts
where t.TABLE_NAME = ts.TABLE_NAME
and    t.TABLE_NAME = c.TABLE_NAME
and    t.column_name = c.COLUMN_NAME
order by t.table_name, column_id

0 件のコメント:

コメントを投稿