表1 表2
________________ ___________
a b c d a e
---------------- -------------
1 2 3 4 1 4
2 2 5 5 2 5
3 2 4 6 3 6表3 表4
_______________ _______________
w f e b W F
--------------- ---------------
1 2 1 2 _______________
2 2 2 2 _______________
3 4 2 4 _______________我想循环的根据表1中 a 取得表2中的 e 值。然后再根据表1中 a 对应的 b 值,根据e,b两个值在表3中取得记录插入到表4中。请问怎么实现???分不够可以再加。谢谢了!
________________ ___________
a b c d a e
---------------- -------------
1 2 3 4 1 4
2 2 5 5 2 5
3 2 4 6 3 6表3 表4
_______________ _______________
w f e b W F
--------------- ---------------
1 2 1 2 _______________
2 2 2 2 _______________
3 4 2 4 _______________我想循环的根据表1中 a 取得表2中的 e 值。然后再根据表1中 a 对应的 b 值,根据e,b两个值在表3中取得记录插入到表4中。请问怎么实现???分不够可以再加。谢谢了!
表1
________________
a b c d
----------------
1 2 3 4
2 2 5 5
3 2 4 6 表2
___________
a e
-----------
1 4
2 5
3 6表3
_______________
w f e b
---------------
1 2 1 2
2 2 2 2
3 4 2 4 表4
_____________
W F
-------------
(select w,f from 表1 a,表2 b,表3 c where a.a=b.a and b.e=c.e and a.b=c.b)
select w,f from 表3 ,表1
where e=(select e from 表2 where a= 表1.a) and b=表1.b
要求?
cursor c_test is
select w,f from 表1 a,表2 b,表3 c where a.a=b.a and b.e=c.e and a.b=c.b;for c_get_test in c_test loop
insert into 表4 values(c_get_test.w,c_get_test.f);
end loop;
Select w,f From tab3 Where (tab3.e,tab3.b) In
(Select e,b From tab1,tab2 Where tab1.a=tab2.a);Insert Into tab4
Select w,f From tab1,tab2,tab3 Where
tab1.a=tab2.a And tab1.b=tab3.b And tab2.e=tab3.e;