根据表名获得字段信息及注释且按建表字段顺序

1 select col.TABLE_NAME,col.COLUMN_NAME,col.DATA_TYPE,col.DATA_LENGTH,col.NULLABLE,com.comments,com.owner 
2 from dba_tab_columns col join dba_col_comments com
3 on col.TABLE_NAME = com.table_name and col.COLUMN_NAME = com.column_name
4 and com.table_name ='CW_CB_ACT'
5 order by col.COLUMN_ID

执行结果:

 
其他sql:
获取表信息:
select t.* from user_tab_comments t where comments is not null
and t.table_name = 'CW_CB_ACT'
 

给表填加注释:SQL>comment on table 表名 is '表注释";

给列加注释:SQL>comment on column 表.列 is '列注释';

posted @ 2012-03-06 14:23  rattersnake  阅读(314)  评论(0编辑  收藏  举报