begin
update table_a set id=7 where id=8;
update table_a set id=8 where id=7;
end;

解决方案 »

  1.   

    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;
      

  2.   

    楼上的。你 认为update table_a set id=id+1  where id>100这条可以执行吗?
      

  3.   

    如果你的表的ID不是主键就比较容易
    update A set ID=15-ID where ID=8 or ID=7;
      

  4.   

    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;
      

  5.   

    不明白楼主的意思啊,是要用一个update语句实现你的目的吗?这好像不可能哦!
      

  6.   

    我也觉得是是不可能,就是想想会不会有SQL语句可以实现
      

  7.   

    有个人给我这么个方法,用DECODE函数可以,但我不知道怎么写