您的位置:首页 > 数据库 > Oracle

oracle使用comment注释的方法

2013-04-01 17:09 253 查看
在oracle中有时候需要用到字段注释,那么就需要用到comment,那么comment的语法是怎样的呢,现在我来总结一下,以备以后使用的时候方便查看:

先创建一个表,例如:

create table AA(

a_id number primary key not null,

a_name varchar(20)

);

comment on table AA is '我的表';---------表注释

comment on column AA.a_id is '编号'; -------列注释

测试效果:

select * from user_tab_comments where comments is not null;

TABLE_NAME TABLE_TYPE COMMENTS

------------------------------ ----------- --------------------------------------------------------------------------------

select * from user_tab_comments where table_name is '我的表';

TABLE_NAME TABLE_TYPE COMMENTS

------------------------------ ----------- --------------------------------------------------------------------------------

AA TABLE 我的表

select * from user_column_comments where comments is not null;

TABLE_NAME COLUMN_NAME COMMENTS

------------------------------ ------------------------------ --------------------------------------------------------------------------------

AA AID 编号
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: