日期:2014-05-16  浏览次数:20575 次

powerdesigner创建oracle 数据库表,设置表主键列为自动增长(转_修改版)

1 在表视图的列上创建。
双击表视图,打开table properties ———>columns ,
双击要设置的列(显示列的序号的那个按钮,单击后,会显示横向的黑色箭头)。
打开column properties 对话框。在 ‘general’ 项中,
最下面,找到 sequence,下拉框 后面,有三个按钮就 ‘create’,‘select’,‘properties’。?
新建的话就点击‘create' 打开 sequence properties 对话框,general 中的name, code 随意修改
切换到 physical options 项,输入下面几项内容
start with 1
increment by 1
minvalue 1
maxvalue 根据自己需要决定是否要设定。没有的话,选择 no max value
no cache 勾选

输入完后,点击应用。创建完毕。在 preview 中 可以看到相应的创建代码
同时,在table properties———>preview 的创建代码中,自动加入了 触发器trigger 的创建代码。
创建完成。

使用:到table properties———>preview 中拷贝table 的创建代码,赋值到plsql中执行。
例如:
create table G_EC_LotteryCategory? (
?? lcId?????????????? NUMBER(3)?????????????????????? not null,
?? lcName???????????? NVARCHAR2(30),
?? lcAbbr???????????? NVARCHAR2(20),
?? constraint PK_G_EC_LOTTERYCATEGORY primary key (lcId)