December 28, 2014 at 4:35 am
I have to translate your application with SQL Server on Oracle.
I have 2 tables:
create table aaa
(
id_a int,
id_b int
)
truncate table aaa
insert into aaa values(1,1)
insert into aaa values(2,2)
select * from aaa
create table bbb
(
id_aa int,
id_bb int
)
truncate table bbb
insert into bbb values(1,11)
insert into bbb values(2,22)
select * from bbb
I have this code:
update a
set a.id_b = b.id_bb
FROM aaa a, bbb b
WHERE a.id_a = b.id_aa
How to translete to Oracle this code without cursor?
https://www.youtube.com/user/learnwithtutorials/playlists
December 28, 2014 at 4:42 am
You can use MERGE clause:
MERGE INTO aaa a
USING(
SELECT id_aa ,
id_bb
FROM bbb
)e
ON(a.id_a =e.id_aa)
WHEN MATCHED THEN
UPDATE SET a.id_b =e.id_bb
select * from aaa
www.learn-with-video-tutorials.com - video tutorials
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply