comment [Oracle SQL]

本文介绍如何在Oracle SQL中使用注释功能为表、视图和列添加有意义的说明,并通过SQL查询获取这些注释,增强数据库的可读性和维护性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<pre name="code" class="java">comment [Oracle SQL]
  comment on table  some_table       is 'some hopefully meaningful comment for some_table';
comment on table  some_view        is 'Views can also be commented, yet the statement is still: comment on table';
comment on column some_table.col_1 is 'Be sure to really give some meaningful comment';
comment on column some_view.col_1  is 'Useless, or wrong comments, are worse than no comment at all';
The comment statement allows to store some comments about tables, views or columns in the data dictionary. Even when views are commented, the syntax is comment on table. The comments for tables and views can be retrieved with something like column comments format a50
select table_name, comments from user_tab_comments where table_name like 'SOME%';
TABLE_NAME                     COMMENTS
------------------------------ --------------------------------------------------
SOME_TABLE                     some hopefully meaningful comment for some_table
SOME_VIEW                      Views can also be commented, yet the statement is
                               still: comment on table
Similarly, the comments for columns can be found with something like column comments format a50
select table_name, column_name, comments from user_col_comments where table_name like 'SOME%';
TABLE_NAME                     COLUMN_NAME                    COMMENTS
------------------------------ ------------------------------ --------------------------------------------------
SOME_TABLE                     COL_1                          Be sure to really give some meaningful comment
SOME_TABLE                     COL_2
SOME_TABLE                     COL_3
SOME_VIEW                      COL_1                          Useless, or wrong comments, are worse than no comm
                                                              ent at all

SOME_VIEW                      COL_2
SOME_VIEW                      COL_3
See also comments (PL/SQL). 
</pre>
<p> </p>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值