日期:2014-05-16 浏览次数:20485 次
create sequence s_user_info //user_info是表名 increment by 1 start with 1 maxvalue 99999999 nocycle nocache //以下是查看数据库里面的序列 select sequence_name from user_sequences
create or replace trigger tri_user_info before insert on user_info for each row declare -- local variables here nextid number; begin select s_user_info.nextval//此为上面创建的序列 into nextid from sys.dual; :new.ID:=nextid;//ID为主键 end tri_user_info;