ORA-01779: The columns corresponding to the non-key save table cannot be modified

Source: Internet
Author: User

When I updated a view, I encountered this error: ORA-01779: could not modify the column corresponding to the non-key save table

01779,000 00, "cannot modify a column which maps to a non key-preserved table"
// * Cause: An attempt was made to insert or update columns of a join view which
// Map to a non-key-preserved table.
// * Action: Modify the underlying base tables directly.

You can simulate this error:

SQL> desc gw2
Name Type Nullable Default Comments
-------------------------------------
SID INTEGER Y
OLD_SID INTEGER Y

SQL> select * from gw1;
 
ID SID
------------------------------------------------------------------------------
1 1
2 2
3 3
4
 
SQL> select * from gw2;
 
SID OLD_SID
------------------------------------------------------------------------------
1 11
2 22
3 33
 
SQL> update (select gw1.sid, gw2.old _ sid from gw1, gw2 where gw1.sid = gw2.sid) s set s. sid = s. old_sid;
 
Update (select gw1.sid, gw2.old _ sid from gw1, gw2 where gw1.sid = gw2.sid) s set s. sid = s. old_sid
 
ORA-01779: The columns corresponding to the non-key save table cannot be modified

This is because one sid in gw1 cannot correspond to the sid of a unique gw2 table. That is to say, the sid of gw2 cannot be unique. The solution is to add the unique constraint to the sid of gw2.

SQL> alter table gw2 modify sid unique;
 
Table altered
 
SQL> update (select gw1.sid, gw2.old _ sid from gw1, gw2 where gw1.sid = gw2.sid) s set s. sid = s. old_sid;
 
3 rows updated

In this way, you can.

GoldenGate performs two-way Oracle-Oracle replication without using a Data Pump

One-way Oracle-Oracle Replication Using the GoldenGate Data Pump

How to debug Oracle Data Pump (expdp/impdp)

Oracle Database Export data pump (EXPDP) file storage location

Export of Oracle 10g Data Pump Partition Table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.