106.Oracle数据库SQL开发之 表——向表中添加注释

来源:互联网 发布:网络错误代码-7 编辑:程序博客网 时间:2024/05/19 17:59

106.Oracle数据库SQL开发之 表——向表中添加注释

欢迎转载,转载请标明出处:   http://blog.csdn.net/notbaron/article/details/50043031     

 注释有助于记住表或列的用途。使用COMMENT语句可以为表或列添加注释。

例如:

 

store@PDB1> comment on table order_status2 is'order_status2 stores the state of an order';

 

Comment created.

为列添加注释:

store@PDB1> comment on columnorder_status2.last_modified is 'last_modified stores the date and time theorder was modified last';

 

Comment created.

1.  获得表的注释

通过user_tab_comments视图可以获得有关表的注释:

store@PDB1> select * from user_tab_comments wheretable_name='ORDER_STATUS2';

 

TABLE_NAME

----------------------------------------------------------------------------------------------------

TABLE_TYPE

-----------

COMMENTS

----------------------------------------------------------------------------------------------------

ORIGIN_CON_ID

-------------

ORDER_STATUS2

TABLE

order_status2 stores the state of an order

             3

2.  获得列的注释

通过user_col_comments视图可以获得有关列的注释。

store@PDB1> select * from user_col_comments wheretable_name='ORDER_STATUS2';

 

TABLE_NAME

----------------------------------------------------------------------------------------------------

COLUMN_NAME

----------------------------------------------------------------------------------------------------

COMMENTS

----------------------------------------------------------------------------------------------------

ORIGIN_CON_ID

-------------

ORDER_STATUS2

ID

 

             3

 

ORDER_STATUS2

STATUS

 

             3

 

ORDER_STATUS2

LAST_MODIFIED

last_modified stores the date and time theorder was modified last

             3

 

ORDER_STATUS2

MODIFIED_BY

 

             3

 

 

 

 

 

 

 

 

0 0