我是刚学,我也没见过你说的自增量,不过我可以肯定ora有这样的东西

解决方案 »

  1.   

    第一步:创建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;
      

  2.   

    相信bzszp(SongZip) 吧,
    我以前问过一样的问题,就是他那样解决的。
      

  3.   

    序列(SEQUENCES)1、定义序列
    CREATE SEQUENCES 序列名
           INCREMENT BY n              /* 步长
           START WITH   n              /* 起始值
           MINVALUE     n | NOMINVALUE /* 是否设最小值,最小值N
           MAXVALUE     n | NOMAXVALUE /* 是否设最大值,最大值N
           CYCLE   | NOCYCLE           /* 到达最大值后是否循环使用
           CACHE n | NOCACHE           /* 把下N个序列值2、使用序列
       INSERT INTO AA(ID) VALUES(序列名.NEXTVAL);
      

  4.   

    呵呵, bzszp(SongZip) 兄,给你挑点错误:
    create or replace trigger bef_ins_t_country_define
      before insert on t_country_define
      for each row
    begin
      :new.country_id := s_country_id.nextval;
    end;
    /
      

  5.   

    呵呵, bzszp(SongZip) 兄,给你挑点错误:
    create or replace trigger bef_ins_t_country_define
      before insert on t_country_define
      for each row
    begin
      :new.country_id := s_country_id.nextval;
    end;
    /
      

  6.   

    呵呵, bzszp(SongZip) 兄,给你挑点错误:
    create or replace trigger bef_ins_t_country_define
      before insert on t_country_define
      for each row
    begin
      :new.country_id := s_country_id.nextval;
    end;
    /
      

  7.   

    oracle中的sequence可以满足这中要求。另外 你也可以通过一个整形变量的自增1的循环来达到这种要求。