需要修改的地方都已经加粗了
一、创建表
create table ORGUSER
(
id NUMBER not null,
name VARCHAR2(255),
sex NUMBER(1),
age NUMBER(3)
)
二、创建主键
alter table ORGUSER
add constraint 主键 primary key (ID)
using index
tablespace USERS
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
三、创建序列
CREATE SEQUENCE ORGUSER_ID_S; – ORGUSER_ID_S是序列名称
四、创建触发器
create or replace trigger ORGUSER_ID_T
before insert
on ORGUSER
for each row
declare
– local variables here
begin
SELECT ORGUSER_ID_S.nextval INTO :new.id FROM dual;
END ORGUSER_ID_T;