Table, view or collumn comments
Summary
In the database dictionary, table or view and collumn comments are stored in views DBA_TAB_COMMENTS and DBA_COL_COMMENTS
In the database dictionary, table or view and collumn comments are stored in views DBA_TAB_COMMENTS and DBA_COL_COMMENTS
SELECT OBJECT_NAME FROM DBA_OBJECTS
WHERE OBJECT_NAME LIKE 'DBA_%COMMENTS%'
AND OWNER = 'SYS';
OBJECT_NAME
------------------------
DBA_COL_COMMENTS
DBA_TAB_COMMENTS
DBA_OPERATOR_COMMENTS
DBA_INDEXTYPE_COMMENTS
DBA_MVIEW_COMMENTS
For example to see the comments for view DBA_ROLES:SELECT * FROM DBA_TAB_COMMENTS
WHERE TABLE_NAME = 'DBA_ROLES';
OWNER TABLE_NAME TABLE_TYPE COMMENTS
----------------------------------------------------------------------------------------
SYS DBA_ROLES VIEW All Roles which exist in the database
To find the collumn comments of the view DBA_ROLESSELECT * FROM DBA_COL_COMMENTS
WHERE table_name = 'DBA_ROLES';
OWNER TABLE_NAME COLUMN_NAME COMMENTS
-----------------------------------------------------------------------------------------------------------
SYS DBA_ROLES ROLE ROLE NAME
SYS DBA_ROLES PASSWORD_REQUIRED Indicates IF THE ROLE requires a PASSWORD TO be enabled
If you want to add comments in a table or collumn use the following syntaxCOMMENT ON TABLE TABLE_NAME IS 'this is a test comment on table';
COMMENT ON COLUMN TABLE_NAME.COLLUMN_NAME IS 'this is a test comment on collumn';
You can drop a table comment, you simply do an edit to nothingCOMMENT ON TABLE TABLE_NAME IS '';
Comments
Post a Comment