1. 表级 (1)、对表进行注释:
SQL>comment on table <表名> is <'正文'>;
--小写格式
SQL>COMMENT ON TABLE <表名> IS <'正文'>;
--大写格式
(2)、查看表的注释:
SQL>select comments from user_tab_comments where table_name='表名';
--小写格式
SQL>SELECT COMMENTS FROM user_tab_comments WHERE TABLE_NAME='表名';
--大写格式
(3)、样例 SQL> comment on table dept is 'scotts deptno table' ;
Comment added
SQL> select comments from user_tab_comments where table_name='DEPT';
COMMENTS
--------------------------------------------------------------------------------
scotts deptno table
2. 列级(1)、对列进行注释:SQL>comment on column <表名.列名> is '正文';
--小写格式
SQL>COMMENT ON COLUMN <表名.列名> IS '正文';
--大写格式
(2)、查看列的注释:
SQL>select comments from user_col_comments where table_name='表名' and column_name='列名';
--小写格式
SQL>SELECT COMMENTS FROM user_col_comments WHERE TABLE_NAME='表名' AND COLUNM_NAME='列名';
--大写格式
(3)、样例 SQL> comment on column dept.dname is ' scotts table mean column which name is depts name ';
Comment added
SQL> select comments from user_col_comments where table_name='DEPT' and column_name='DNAME';
COMMENTS
--------------------------------------------------------------------------------
scotts table mean column which name is depts name
|