1. 程式人生 > >Oracle觸發器例項

Oracle觸發器例項

# 觸發器

create or replace trigger tr_tmp

before insert on emp

for each row

begin

select empno_seq.nextval   into :new.empno from dual;

end

insert into emp(ename,deptno)

values('南昌',20);

# 序列,---序號生成器

select empno_seq.nextval from dual;

select empno_seq.currval from dual;

# 修改序列

alter sequence empno_seq increment by n

start with n

maxvalue n | nomaxvalue

minvalue n | nominvalue

cycle | nocycle

cache n | nocache

# 刪除序列

drop sequence empno_seq;