pl sql developer 中如何将一个已建好的表中的某一字段设置为自动增长列,增幅为1,请高手指点。

解决方案 »

  1.   

    SQL> create   table  whutlichao(b int, c varchar2(5));Table createdSQL> create   sequence   a_seq   increment   by   1   start   with   100;Sequence createdSQL> SQL> 
    SQL> create or replace trigger t_a
      2    before insert on whutlichao
      3    for each row
      4  begin
      5    select a_seq.nextval into :new.b from dual;
      6  end;
      7  /Trigger created
    SQL> insert into whutlichao values(100,'whu');1 row insertedSQL> commit;Commit completeSQL> select * from whutlichao;                                      B C
    --------------------------------------- -----
                                        100 whuSQL> 
      

  2.   


    SQL> select * from whutlichao;                                      B C
    --------------------------------------- -----
                                        100 whu
                                        101 whuSQL>