时间:2020-12-18 01:50:58 | 栏目:Oracle | 点击:次
oracle中用comment on命令给表或字段加以说明,语法如下:
用法如下:
1.对表的说明
2.对表中列的说明
3.查看表的说明
SQL> select * from user_tab_comments where comments is not null;
TABLE_NAME TABLE_TYPE COMMENTS
------------------------------ ----------- --------------------------
EMPLOYEES TABLE 员工表
4.查看表中列的说明
SQL> select * from user_col_comments where comments is not null;
TABLE_NAME COLUMN_NAME COMMENTS
------------------------------ ------------------------------ -------------
EMPLOYEES SALARY 员工薪水
5.我们也可以从下面这些视图中查看表级和列级说明:
6.删除表级说明,也就是将其置为空
SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';
TABLE_NAME TABLE_TYPE COMMENTS
------------------------------ ----------- -------------
EMPLOYEES TABLE
7.删除列级说明,也是将其置为空
SQL> select * from user_col_comments where TABLE_NAME='EMPLOYEES';
TABLE_NAME COLUMN_NAME COMMENTS
------------------------------ ------------------------------ -------------
EMPLOYEES EMPLOYEE_ID
EMPLOYEES MANAGER_ID
EMPLOYEES FIRST_NAME
EMPLOYEES LAST_NAME
EMPLOYEES TITLE
EMPLOYEES SALARY