Oracle 批量获得数据库中表字段,类型说明,列注释等

select distinct t1.TABLE_NAME,--表名
                t1.COLUMN_NAME,--列名
                t1.DATA_TYPE,--列类型
                t1.DATA_LENGTH,--列长度
                t1.NULLABLE,--是否可以为空
                t1.COLUMN_ID,--列创建的时候顺序
                t2.COMMENTS,--表的注释
                t3.COMMENTS --列的注释
  from user_tab_columns t1, user_tab_comments t2, user_col_comments t3
 where t1.TABLE_NAME = t2.TABLE_NAME
   and t1.COLUMN_NAME = t3.COLUMN_NAME
   and t1.TABLE_NAME = t3.TABLE_NAME
   --查询表名以xx开头的所有表
   and t1.TABLE_NAME like 'OMS%'
 order by t1.TABLE_NAME, t1.COLUMN_ID

猜你喜欢

转载自wodeguozili.iteye.com/blog/2166017