SQL> select * from a; A B C D --------------------------------------- --------------------------------------- --------------------------------------- ---------------------------------------SQL> select * from b; A B --------------------------------------- --------------------------------------- 1 1 2 2 3 3 4 4SQL> insert into a select a,b,8888,9999 from b;4 rows insertedSQL> select * from a; A B C D --------------------------------------- --------------------------------------- --------------------------------------- --------------------------------------- 1 1 8888 9999 2 2 8888 9999 3 3 8888 9999 4 4 8888 9999SQL>
insert into aa (a,b,c,d) select (a,b,参数c,参数d) from bb where
第一步: insert into aa(a,b) select (a,b) from bb where ....第二步: update aa set c = &c and d = &d where a = (select a from bb where...) and b = (select b from bb where...)
SQL> select * from a; A B C D
--------------------------------------- --------------------------------------- --------------------------------------- ---------------------------------------SQL> select * from b; A B
--------------------------------------- ---------------------------------------
1 1
2 2
3 3
4 4SQL> insert into a select a,b,8888,9999 from b;4 rows insertedSQL> select * from a; A B C D
--------------------------------------- --------------------------------------- --------------------------------------- ---------------------------------------
1 1 8888 9999
2 2 8888 9999
3 3 8888 9999
4 4 8888 9999SQL>
select (a,b,参数c,参数d)
from bb where
insert into aa(a,b)
select (a,b)
from bb
where ....第二步:
update aa
set c = &c
and d = &d
where a = (select a from bb where...)
and b = (select b from bb where...)