Search notes:

ORA-01779: cannot modify a column which maps to a non key-preserved table

Demonstration of the error

The following two tables and SQL statements try to demonstrate the ORA-01779: cannot modify a column which maps to a non key-preserved table error:
create table tq84_dest ( id number not null, val varchar2(5));
create table tq84_src  ( id number not null, val varchar2(5));
 
begin
insert into tq84_dest  values(1, 'i'  );
insert into tq84_dest  values(3, 'iii');
insert into tq84_dest  values(4, 'iv' );
 
insert into tq84_src values (1, 'one');
insert into tq84_src values (2, 'two');
insert into tq84_src values (4, 'four');
 commit;
end;
/
 
update (
   select
      s.val s_val,
      d.val d_val
   from
      tq84_dest d  join
      tq84_src  s on d.id = s.id
)
set
   d_val = s_val;
The error disappears if the «source» table's join-column is guaranteed to be unique:
alter table tq84_src add primary key(id); 

update (
   select
     …
Querying the modified destination table:
select * from tq84_dest;
Cleaning up:
drop table tq84_dest;
drop table tq84_src;

See also

ORA-01732: data manipulation operation not legal on this view
Other Oracle error messages

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759437506, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/errors/ORA-01779_cannot-modify-a-column-which-maps-to-a-non-key-preserved-table(84): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78