Oracle uses comment statements to add Table Comments

Source: Internet
Author: User

Oracle uses comment statements to add Table Comments

The Oracle comment statement can be used to add remarks to tables, fields, views, and other objects.

Syntax:
Comment on TABLE table_name IS 'Remarks ';

Permission requirements:
By default, users can only add comments to their own objects.
If you want to add comments to other user objects, you must have the permission: COMMENT ANY TABLE

Related Data Field View:
USER_TAB_COMMENTS
DBA_TAB_COMMENTS
ALL_TAB_COMMENTS
USER_COL_COMMENTS
DBA_COL_COMMENTS
ALL_COL_COMMENTS

Example:
Drop table t;
Create table t (id number );

Select * from user_tab_comments;

TABLE_NAME TABLE_TYPE COMMENTS
------------------------------------------------------------------------------------------
T TABLE

Select * from USER_COL_COMMENTS;

SCOTT @ orcl> select * from USER_COL_COMMENTS WHERE table_name = 'T ';

TABLE_NAME COLUMN_NAME COMMENTS
------------------------------------------------------------------------------------------
T ID

-- Add comments
SCOTT @ orcl> comment on table t is 'test table T ';

Note created.

SCOTT @ orcl> comment on column t. id is 'row id ';

Note created.

SCOTT @ orcl> select * from user_tab_comments WHERE table_name = 'T ';

TABLE_NAME TABLE_TYPE COMMENTS
------------------------------------------------------------------------------------------
T table test TABLE T

SCOTT @ orcl> select * from USER_COL_COMMENTS WHERE table_name = 'T ';

TABLE_NAME COLUMN_NAME COMMENTS
------------------------------------------------------------------------------------------
T id row ID

For more information, see: http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_4009.htm#i2119719

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.