Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Joins used in MERGE command

KVBJul 24 2015 — edited Jul 25 2015

Hi

I have a Table 1 and Table 2 joined on some conditions and INSERT/UPDATE the data in Table 3.

I have found examples on MERGE command using only 2 tablesbelow.. Can i use Joins in the USING clause like (select * from table inner join table 2 on .....) .. Suggest me .

SQL> merge into student a

  2 using

  3 (select id, name, score

  4 from student_n) b

  5 on (a.id = b.id)

  6 when matched then

  7 update set a.name = b.name

  8 , a.score = b.score

  9 when not matched then

10 insert (a.id, a.name, a.score)

11 values (b.id, b.name, b.score);

Can i use something like this

MERGE into Table3

USING

(

SELECT A.* FROM TABLE A INNER JOIN TABLE B ON A.ID=B.ID) Table2

on(Table2.Id=table3.ID)

when matched then ........

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2015
Added on Jul 24 2015
2 comments
570 views