Add and read comments and ORACLE comments to tables and columns in oracle
Add and read comments to tables and columns in ORACLE
1. Add a comment to the table: SQL> comment on table name is 'table comment ";
2. Add a comment to the column: SQL> comment on column table. The column is 'column annotation ';
3. read Table comments: SQL> select * from user_tab_comments where comments is not null;
4. Read the column comment: SQL> select * from user_col_commnents where comments is not null and table_name = 'table name ';
The structure of USER_TAB_COMMENTS and user_col_comments in the appendix:
1. user_tab_comments consists of three parts: table_name, table_type, and comments.
2. user_col_comments consists of three parts: table_name, column_name, and comments.
3. display the table structure in SQL * PLUS: desc table name;
In oracle databases, how do I add comments to a field using SQL statements? People who need to know the details are disclosed.
Comment on column table name. COLUMN name IS 'comment content ';
How can I obtain the annotation of an oracle database table in a program?
1. select * from user_col_comments where table_name = 'table name'
2. select * from USER_TAB_COMMENTS where table_name = 'table name'
The first is to query field comments, the second is the comments of the table, and the table name must be capitalized.