--创建表foo
create table foo( 
   id   number   primary key, 
   data varchar2(100)
); 
 
--创建序列foo_seq
create sequence foo_seq; 
                         
--创建触发器 bifer_scope_id                     
create or replace trigger bifer_scope_id  
    before insert
    on foo  --foo表
    for each row
    begin
       select foo_seq.nextval into :new.id from dual; --明确序列和主键字段
    end;