一条sql查出数据库某张表的所有属性

select t.TABLE_NAME,--表名
       t.COLUMN_NAME,--字段名
       t.DATA_TYPE,--字段属性
       t.DATA_LENGTH,--类型长度
       t.DATA_PRECISION,
       t.NULLABLE,--是否必填
       (select c.comments
          from user_tab_comments c
         where c.table_name = upper('CMS_T_COLLATERAL_DIRECTORY_INF')
           and c.table_name = t.TABLE_NAME) table_comments,
       (select c.comments
          from user_col_comments c
         where c.table_name = upper('CMS_T_COLLATERAL_DIRECTORY_INF')
           and c.COLUMN_NAME = t.COLUMN_NAME) column_comments
  from user_tab_columns t
 where t.table_name = upper('CMS_T_COLLATERAL_DIRECTORY_INF')
 order by t.COLUMN_ID

 

posted @ 2015-08-26 10:04  也许还年轻  阅读(510)  评论(0编辑  收藏  举报