http://expert.csdn.net/Expert/topic/1153/1153511.xml?temp=.1822016

解决方案 »

  1.   

    建立序列:
    create sequence TEST
    minvalue 1
    maxvalue 100000    //最大值
    start with 1  //初始值
    increment by 1调用序列:
    select test.nextval from dual
      

  2.   

    不对,应该使用number(n,0)(即整型),然后设置它的初始值及递增值,不就ok了吗???
      

  3.   

    oracle 中没有这样的字段,要想实现这样的功能必须自己做一些改动。我用的一张表,记录了我所用到的表的当前id号,然后,每次插入新的记录时,同是更新这张id表,就可以了。
      

  4.   

    Oracle上没有自增字段,可以使用索引和触发器来达到此目的
    第一步:创建SEQUENCE
    create sequence s_country_id increment by 1 start with 1 maxvalue 999999999;
    第二步:创建一个基于该表的before insert 触发器,在触发器中使用该SEQUENCE
    create or replace trigger bef_ins_t_country_define
    before insert on t_country_define
    referencing old as old new as new for each row
    begin
    new.country_id=s_country_id.nextval;
    end;