两表关联更新,用于update 回滚

create table test1 as select * from dba_objects;

create table test2 as select * from dba_objects;

create unique index test1_idx1 on test1(object_id);


select * from test1;

create  table test3 as select object_id,object_name from test1

update test1 set object_name='xx';

SQL> update test1 set object_name=(select object_name from test3);
update test1 set object_name=(select object_name from test3)
                              *
ERROR at line 1:
ORA-01427: single-row subquery returns more than one row

update test1 set test1.object_name=(select test3.object_name from test3 where test1.object_id=test3.object_id)

你可能感兴趣的:(两表关联更新,用于update 回滚)