Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

ORA-01779 on SQL update tips

Oracle Tips by Burleson Consulting

Updated August 9, 2011

 

Question: I cannot get this update to run and I get the ORA-01779 error:

ORA-01779: cannot modify a column which maps to a non key-preserved table.
 
update
   (select
      src.object_name AS src_name,
      src.object_type AS src_type,
      tgt.object_name AS tgt_name,
      tgt.object_type AS tgt_type,
    from
      source_table src,
      target_table tgt
    where
      src.object_id = tgt.object_id)
set
   tgt_name = src_name,
   tgt_type = src_type;

 

Answer:  Using the oerr utility, the Oracle docs note this on the ORA-01779 error:

ORA-01779: 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.

In your case, the ORA-01779 results because the update statement is malformed (by using an in-line view on two tables) and you want to issue the SQL update directly against one individual table, not the two tables that are specified in your DML syntax.

Views can be updated under the right conditions, in which case, the ORA-01779 will not be an issue.  

Some views support inserts while at the same time rejecting updates.  

Whether a view can be updated depends on the keys from the underlying table or tables.

The answer to the question of whether or not a particular view is updatable is directly  related to the difference between simple and complex views.

Generally, DML can be performed against the view if the base table is key-preserved.

DML is not allowed in situations where duplicate data exists but is suppressed, like with the DISTINCT operator.  Attempting an update using DISTINCT is not allowed because Oracle has no way of knowing which record should be updated.

Thus, with complex views, some columns may be updated and some may not.  This is decided by the table from which the column comes and if there is a primary key or key-preserved value that can be determined.

The ORA-01779 will result if you have inaccurately assessed your table for primary key or key-preserved value integrity.

Follow the jump for more good information on views.

 


 

 

��
 
 
 
 

 
 
 

 
Oracle performance tuning software 
 
oracle dba poster
Oracle Linux poster
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright ? 1996 -  2014

All rights reserved by Burleson

Oracle ? is the registered trademark of Oracle Corporation.