begin update table_a set id=9 where id=8; update table_a set id=8 where id=7; update table_a set id=7 where id=9;end;
楼上的。你 认为update table_a set id=id+1 where id>100这条可以执行吗?
如果你的表的ID不是主键就比较容易 update A set ID=15-ID where ID=8 or ID=7;
begin select max(id) into max_id from table_a update table_a set id=max_id+1 where id=8; update table_a set id=8 where id=7; update table_a set id=7 where id=max_id+1;end;
update table_a set id=9 where id=8;
update table_a set id=8 where id=7;
update table_a set id=7 where id=9;end;
update A set ID=15-ID where ID=8 or ID=7;
select max(id) into max_id from table_a
update table_a set id=max_id+1 where id=8;
update table_a set id=8 where id=7;
update table_a set id=7 where id=max_id+1;end;