oracle里面的一个表,如何将主键id设置为自动增加呢?表已经建好了,用sql语言写的,但是忘记了设置自动增加了,怎么办?希望高手指点一下。

解决方案 »

  1.   

    create sequence s;
    insert into test values(s.nextval);
      

  2.   


    create table test(id number);
    create sequence s;
    insert into test values(s.nextval);
    insert into test values(s.nextval);
    insert into test values(s.nextval);select * from test;
            ID
    ----------
             1
             2
             3
      

  3.   

    是不是把这个语句在sql里一执行就行了?