insert into select 中使用序号

今天写sql:insert into select中想使用序列:

insert into R_POL_VIPO (id, SUMVIPONUM, STATSTICSDATE)
  select R_POL_VIPO_seq.Nextval, VIPONUM, sysdate from R_POL_VIPO

 

结果报错:此处序号不许使用,修改成如下结构就ok啦...

insert into R_POL_VIPO (id, SUMVIPONUM, STATSTICSDATE)
  select R_POL_VIPO_seq.Nextval, b.*
    from (select VIPONUM, sysdate from R_POL_VIPO) b;

 

你可能感兴趣的:(【数据库】)