create sequence seq_userinfo //创建序列
minvalue 1 start with 1 increment by 1; //从1开始每次递增1
create or replace trigger trigger_name //创建触发器
before insert on table_name //触发器相应的时间,即当向数据库中存入数据时发生
for each row declare begin
select seq_userinfo.nextval into:new.id from dual;
end tigger_userinfo;