Skip to Main Content

SQL & PL/SQL

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!

Using merge to insert or update two tables in diffrence schema in store procedure

Cuong-nmMar 29 2019 — edited Jun 26 2019

Hi !

I have two schema: A1 và A2. And I have "Cates" table in the both schema.

I create a store procedure "SyncData" in A1 with details:

CREATE OR REPLACE NONEDITIONABLE PROCEDURE A1.SyncData  AS

   BEGIN

            MERGE INTO A2.Catest2

  USING (SELECT * FROM A1.Cates) t1

ON (t2.ID = t1.ID)

WHEN MATCHED THEN

  UPDATE SET

t2.Name = t1.Name

WHEN NOT MATCHED THEN

        INSERT

          (t2.ID, t2.Name)

        VALUES

          (t1.ID, t1.Name);

END;

When I execute that script, the error "ORA-00942: table or view does not exist" has been throwed.

How can I fix it?Please help me !!

This post has been answered by BEDE on Apr 1 2019
Jump to Answer
Comments
Post Details
Added on Mar 29 2019
10 comments
9,064 views