Saturday, July 23, 2011

How to add caption to a table in Oracle using sql?

We have no idea what captions are in relation to Oracle. A search on http://www.oracle.com and on the Oracle Technology Network (including all the documentation) did not show anything that might be relevant.

We can only assume (with a little lateral thinking) that your are referring to comments about tables, columns, views, editions (from 11g onwards), operators, and indextypes in the Oracle database. Table comments are stored in ALL/USER/DBA_TAB_COMMENTS and column comments are stored in ALL/USER/DBA_COL_COMMENTS. The other types of comments are stored in their respective ALL/USER/DBA__COMMENTS tables which can be queried in the same way as any other table. These comments add to the database meta data and are used to provide additional information about the tables, columns and views etc. you create in your Oracle database.

Adding comments for a table, column, view etc is simply a matter of using the SQL COMMENT ON statement, specifying the type of object (table, column, view, etc) as well as the object name and for a column the name of the owning table or view.

For example to add a comment on your table "emp" the SQL command would be:

COMMENT ON TABLE emp IS 'copy of employees table but without the foreign key constraints';.


0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Deep's | Bloggerized by Deep - Deep's Templates | ElearSQL-Server