table1有2个字段:userName varchar2(50),ID int.
说明:ID是自增列(seq_a.nextval)table2 有1个字段,userName现在我想:
insert into table1
select userName,seq_a.nextval
from table2出错,问题:select后不能跟序号seq_a.nextval
怎么解决

解决方案 »

  1.   

    create table tb1(id number(18,0), ename varchar2(20));
    create sequence tb1_seq start with 1 increment by 1 nomaxvalue nocycle;insert into tb1
    select tb1_seq.nextval, ename from emp;已创建14行。已用时间:  00: 00: 00.03
      

  2.   

    谢谢,2个人说的都没有错.具体原因我找到了,原来是有order by 语句