求一个SQL语句(insert into(AA,BB) select acct_item_id_seq.NEXTVAL,id,sum(charge) from TABLE group by id
报的错是acct_item_id_seq.NEXTVAL 这个SEQ不允许写在这里
有没有好的方法实现?
问题点数:20、回复次数:2Top
1 楼skydqboy(学习)回复于 2006-03-05 11:44:11 得分 0
insert into TABLE_DES(AA,BB) select acct_item_id_seq.NEXTVAL,id,sum(charge) from TABLE_SRC group by id;
就这个语句,报的错是:
ORA-02287: sequence number not allowed here
Top
2 楼boydgmx(授人以鱼不如授人以渔(baidu&google))回复于 2006-03-05 14:31:37 得分 20
insert into TABLE_DES(AA,BB) select acct_item_id_seq.NEXTVAL,id,sum(charge) from TABLE_SRC group by id;
-------------
你的目标只有两个字段,你怎么插入三个字段?
insert into TABLE_DES(newid,AA,BB)
select acct_item_id_seq.NEXTVAL,id,cnt
from (
select id,sum(charge) as cnt from TABLE_SRC group by id
);
这样试试看。Top




