对改表上建索引,insert 的时候,该字段为seq.nextval

解决方案 »

  1.   

    我在oracle用到很多自动增加列的,
    就是把序列和触发器结合起来用,非常简单的首先建一序列create sequence foo_seq; (最好在oracle的dba studio里非常简单)
    然后在相应表上写入触发器如:
    create or replace trigger bifer_foo_id_pk 
      before insert 
        on foo 
        for each row 
    begin 
      select foo_seq.nextval into :new.id from dual; 
    end; 这样就ok了