Wednesday, September 14, 2011

Adding a Comment to a Column Description


This simple example, tested on an Oracle 9 database, shows how to add a comment to a column description. First create a table:
 
SQL> create table blah (col1 varchar2(1))
  2  /
 
Table created.
 
SQL>
 
And check that there are no comments on it:
 
SQL> select column_name, comments
  2  from user_col_comments
  3  where table_name = 'BLAH'
  4  /
 
COLUMN_NAME          COMMENTS
-------------------- --------------------
COL1
 
SQL>
 
Then add a comment to column col1 restrospectively and query user_col_comments again:
 
SQL> comment on column blah.col1 is 'Column 1'
  2  /
 
Comment created.
 
SQL> select column_name, comments
  2  from user_col_comments
  3  where table_name = 'BLAH'
  4  /
 
COLUMN_NAME          COMMENTS
-------------------- --------------------
COL1                 Column 1
 
SQL>

1 comment:


  1. My spouse and I love your blog and find almost all of your posts to be just what I’m looking for. Appreciating the persistence you put into your blog and the detailed information you provide. I found another one blog like you Oracle Cloud Infrastructure .Actually I was looking for the same information on internet for Oracle Cloud Infrastructure and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.

    ReplyDelete