oracle comment on的用法
oracle
中用comment on
命令給表或欄位加以說明,語法如下:
COMMENT ON
{ TABLE [ schema. ]
{ table | view }
| COLUMN [ schema. ]
{ table. | view. | materialized_view. } column
| OPERATOR [ schema. ] operator
| INDEXTYPE [ schema. ] indextype
| MATERIALIZED VIEW materialized_view
}
IS 'text' ;
用法如下:
1.對錶的說明
comment on table table_name is 'comments_on_tab_information';
2.對錶中列的說明
comment on column table.column_name is 'comments_on_col_information';
3.檢視錶的說明
SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';
TABLE_NAME TABLE_TYPE COMMENTS
------------------------------ ----------- ----------
EMPLOYEES TABLE 員工表
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 TABLE_NAME='EMPLOYEES';
TABLE_NAME COLUMN_NAME COMMENTS
------------------------------ ------------------------------ ------------
EMPLOYEES EMPLOYEE_ID
EMPLOYEES MANAGER_ID
EMPLOYEES FIRST_NAME
EMPLOYEES LAST_NAME
EMPLOYEES TITLE
EMPLOYEES SALARY 員工薪水
SQL> select * from user_col_comments where comments is not null;
TABLE_NAME COLUMN_NAME COMMENTS
------------------------------ ------------------------------ -------------
EMPLOYEES SALARY 員工薪水
5.我們也可以從下面這些檢視中檢視錶級和列級說明:
ALL_COL_COMMENTS
USER_COL_COMMENTS
ALL_TAB_COMMENTS
USER_TAB_COMMENTS
6.刪除表級說明,也就是將其置為空
SQL> comment on table employees is '';
Comment added
SQL> select * from user_tab_comments where TABLE_NAME='EMPLOYEES';
TABLE_NAME TABLE_TYPE COMMENTS
------------------------------ ----------- -------------
EMPLOYEES TABLE
7.刪除列級說明,也是將其置為空
SQL> comment on column employees.salary is '';
Comment added
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
相關文章
- Oracle comment新增註釋Oracle
- 《Oracle comment on註釋資訊方法論》Oracle
- PowerDesigner 同步Name到Comment 及 同步 Comment 到Name
- Oracle Hints的用法Oracle
- oracle job的用法Oracle
- Oracle keep的用法Oracle
- Oracle Analyze的用法Oracle
- Oracle中with的用法Oracle
- Oracle Hint的用法Oracle
- Oracle的Cast的用法OracleAST
- ORACLE WITH AS 用法Oracle
- oracle explain plan for的用法OracleAI
- 【 Oracle中rownum的用法 】Oracle
- Oracle set unused的用法Oracle
- oracle的interval用法特例Oracle
- Oracle 的 bulk collect用法Oracle
- (轉)Oracle Hint的用法Oracle
- Oracle 中 case的用法Oracle
- oracle execute immediate動態sql組合執行comment小記OracleSQL
- Commit Comment (148)MIT
- oracle樹中prior的用法Oracle
- 【Oracle的NVL函式用法】Oracle函式
- Oracle中rowid的用法Oracle
- 【oracle中rowid的用法】Oracle
- Oracle dump函式的用法Oracle函式
- Oracle trunc()函式的用法Oracle函式
- Oracle Hints語句的用法Oracle
- Oracle 函式 Translate 的用法Oracle函式
- oracle的with函式用法示例Oracle函式
- 常見Oracle HINT的用法Oracle
- ORACLE SQL的EXCEPT、INTERSECT用法OracleSQL
- oracle中copy from的用法Oracle
- 談談Oracle interMedia的用法Oracle
- Oracle set unused的用法.sqlOracleSQL
- oracle臨時表的用法Oracle
- ORACLE SEQUENCE用法Oracle
- oracle cast 用法OracleAST
- oracle job用法Oracle