Is there a column comment syntax that allows me to specify a column comment directly where I declare the column in the create table statement (i.e. inline)? The 11g spec does not mention anything, on another page something is mentioned but I could not get it to work. There is a way to specify comments after creating the table, but I think it is annoying that the comment is separated from the field definition. I am looking for something like this (which does not work):
create table whatever (
field number(15,0) primary key comment 'primary key generated from sequence pkseq',
...
)
Purpose. Use the COMMENT statement to add a comment about a table, view, materialized view, or column into the data dictionary. To drop a comment from the database, set it to the empty string ' '.
Adds, revises, or removes a projection column comment. You can only add comments to projection columns, not to table columns. Each object can have one comment. Comments are stored in the system table COMMENTS .
I'm afraid the "annoying" COMMENT ON
syntax is the only way of doing this. SQL Server, PostgreSQL and DB2 use the same syntax (even though, as far as I know, there is no ANSI standard syntax for adding comments to database objects).
MySQL supports the way you would like it to work. I agree it would be a nicer mechanism, but in my experience so few people use comments at all that I doubt Oracle will ever change it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With