这个问题困扰小白很久了,网上说什么order="BEFORE"或order="AFTER"搞得我就没成功过,现在把这个坑填一下!
1、首先说说Oracle数据库中建表、建序列、建触发器,让ID自增。
(1)、建表,代码如下:
create table USERS
(
id Integer not null,
username VARCHAR2(32) not null,
password VARCHAR2(32) not null,
createtime date,
updatetime date,
rel_name VARCHAR2(32),
telphone VARCHAR2(20),
login_nums Integer default 0 not null,
last_login_time date,
ststus number(2) default 1 not null,
roles_id Integer
)
tablespace USERS
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table USERS
is '用户表';
-- Add comments to the columns
comment on column USERS.username
is '用户名';
comment on column USERS.createtime
is '创建时间';
comment on column USERS.updatetime
is '更新时间';
comment on column USERS.rel_name
is '真实姓名';
comment on column USERS.telphone
is '联系电话';
comment on column USERS.login_nums
is '登陆次数';
comment on column USERS.last_login_time
is '最后一次登陆时间';
comment on column USERS.ststus
is '1-启动 0-禁用';
comment on column USERS.roles_id
is '角色id';
-- Create/Recreate primary, un