////建表
create table test (
user_id NUMBER(7) not null,
user_name VARCHAR2(20) not null,
password VARCHAR2(20) not null,
department VARCHAR2(20) not null,
remark VARCHAR2(200),
constraint PK_test2 primary key (user_id)
)
////产生sequence
create sequence Seq_test
increment by 1
start with 1
nomaxvalue
minvalue 0
nocycle
cache 20
noorder
/////产生trigger
create trigger trg_test before insert on test for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
dummy integer;
found boolean;
begin
select Seq_test.NEXTVAL INTO :new.user_id from dual;
exception
when integrity_error then
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载