orcl序列及触发器代码

序列代码
  
CREATE SEQUENCE  "SCOTT"."USER_SEQUENCE"  
MINVALUE 1 
MAXVALUE 9999999999 
INCREMENT BY 1 
START WITH 21 
CACHE 20 
NOORDER  CYCLE ;



触发器代码
create or replace trigger user_sql before
insert on ICARUSER for each row when (new.user_id is null)
begin
select USER_SEQUENCE.NEXTVAL into:new.user_id from dual;
end;

你可能感兴趣的:(触发器)