不知是否可以 ...insert into ta select seq_name.nextval,fvalue from tb;
CREATE SEQUENCE s_Id START WITH 1 INCREMENT BY 1CREATE TABLE zuime ( ID NUMBER(10), NAME NVARCHAR2(10) )INSERT INTO zuime SELECT s_Id.nextval, fValue FROM TABLE2
insert into ta(fid,fvalue) select rownum,fvalue from tb 这样写,以rownum当自增列,如果ta表是空的这样可以,自增列会从1开始. 如果有ta有记录,比如fid列已经到10了就 insert into ta(fid,fvalue) select rownum+10,fvalue from tb
准备接分中! insert into ta(fid,fvalue) select (select max(fid)+1 from ta), fvalue from tb
修正: insert into ta(tid,tvalue) select (select max(tid) from ta)+rownum, fvalue from tb
START WITH 1
INCREMENT BY 1CREATE TABLE zuime
(
ID NUMBER(10),
NAME NVARCHAR2(10)
)INSERT INTO zuime SELECT s_Id.nextval, fValue FROM TABLE2
比如给定的是 max(fid) = 5,
那么之后insert的值就是 6, 7, 8, 。
select rownum,fvalue from tb
这样写,以rownum当自增列,如果ta表是空的这样可以,自增列会从1开始.
如果有ta有记录,比如fid列已经到10了就
insert into ta(fid,fvalue)
select rownum+10,fvalue from tb
insert into ta(fid,fvalue)
select (select max(fid)+1 from ta), fvalue from tb
insert into ta(tid,tvalue)
select (select max(tid) from ta)+rownum, fvalue from tb