oracle 使用comment語句添加表注釋,oraclecomment

來源:互聯網
上載者:User

oracle 使用comment語句添加表注釋,oraclecomment
使用oracle comment語句可以給表、欄位、視圖等對象添加備忘資訊。


大致文法為:
comment on TABLE table_name IS '備忘內容';


許可權要求:
預設情況下使用者只能給屬於自己的對象添加註釋。
如果要想給其他使用者物件添加註釋需要擁有許可權:COMMENT ANY TABLE


相關資料欄位視圖:
USER_TAB_COMMENTS
DBA_TAB_COMMENTS
ALL_TAB_COMMENTS
USER_COL_COMMENTS
DBA_COL_COMMENTS
ALL_COL_COMMENTS


樣本如下:
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




--添加註釋
SCOTT@orcl> comment on table t is '測試表T';


注釋已建立。


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


注釋已建立。


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


TABLE_NAME                     TABLE_TYPE                     COMMENTS
------------------------------ ------------------------------ ------------------------------
T                              TABLE                          測試表T


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


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




詳細文章請參考:http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_4009.htm#i2119719



























聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.