COMMENT statement is used to add
a comment(description) about a table, view, materialized view, or column into
the data dictionary.
Syntax for Table level comment:
COMMENT ON <table name > IS 'string' ;
Example :
SQL> comment on employee is ' This table is for holding
employee details' ;
SQL> comment on dept is ' This table is created by Russwelt
on 01-Dec-2012';
Syntax for column level comment
:
COMMENT ON <tablename.column name > IS 'string' ;
Column level comments are to add description about column
Examples :
SQL> comment on emp.hiredate is 'This is to store joining
date of employee';
SQL> comment on emp.mgr is 'This is to store manager name of
the employee';
We can view the comments on a particular table or column by
querying the following data dictionary views.
USER_TAB_COMMENTS - For table level
comments
USER_COL_COMMENTS - For column level
comments
To drop comments :
We have to give empty string to remove existing commnets in
tables or columns
Examples :
SQL> comment on employee is '';
SQL> comment on emp.hiredate is '';
No comments:
Post a Comment