ORACLE:
create table t7(c1 number primary key,c2 number);
insert into t7 values (1,3);
insert into t7 values (2,4);
commit;
update t7 set c1=c1+1;
commit ;
select * from t7;
Run Code Online (Sandbox Code Playgroud)
MySQL的:
create table t7(c1 int primary key,c2 int);
insert into t7 values (1,3);
insert into t7 values (2,4);
select * from t7;
update t7 set c1=c1+1;
ERROR 1062 (23000): Duplicate entry '2' for key 'PRIMARY'
Run Code Online (Sandbox Code Playgroud)
为什么MySQL说
update set pk=pk+1 :Duplicate entry '2' for key 'PRIMARY',
ORACLE能做到这一点update set pk=pk+1吗?