Oracle创建带有列注释的表 [英] Oracle create table with column comments

查看:98
本文介绍了Oracle创建带有列注释的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在列注释语法,该语法允许我直接在创建表语句(即内联)中声明列的位置指定列注释? 11g规范另一页被提及但我无法理解去工作.有一种方法可以在创建表后指定注释,但是我认为注释与字段定义分开很烦人.我正在寻找类似的东西(不起作用):

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',
 ...
)

推荐答案

恐怕烦人的" COMMENT ON语法是实现此目的的唯一方法. SQL Server,PostgreSQL和DB2使用相同的语法(尽管据我所知,尚无用于将注释添加到数据库对象的ANSI标准语法).

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支持您希望它的工作方式.我同意这是一个更好的机制,但是根据我的经验,很少有人使用注释,我怀疑Oracle是否会更改它.

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.

这篇关于Oracle创建带有列注释的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆