我知道更新成功之后可以返回主键的值,现在有没有方法可以返回指定更新记录中的某一列的值?   如果没有的话,又要一个sql语句进行查询,好麻烦。

解决方案 »

  1.   

    SQL> select * from a;A                    B                    C
    -------------------- -------------------- ----------
    1                    1b                   1c
    2                    1                    2c
    3                    3                    3cSQL> variable rtn varchar2(20);
    SQL> begin
      2  update a set b = '2b' WHERE A=2 returning c into :rtn;
      3  dbms_output.put_line(:rtn);
      4  end;
      5  /
    2cPL/SQL procedure successfully completed.
      

  2.   

    为什么我在plsql里面不能执行呢。
    variable rtn varchar2(20);
    begin 
    update student set age=276 where id=11 returning age into:rtn;
    dbms_output.put_line(:rtn);
    end;
      

  3.   

    不能一句写完么?
    例如,我用jdbc executeUpdate下,ResultSet中直接拿结果么?
      

  4.   

    PL/SQL Developerdeclare
      rtn number;
    begin 
    update student set age=276 where id=11 returning age into rtn;
    dbms_output.put_line(rtn);
    end;
      

  5.   

    嗯 ,我试了下可以的。
    现在就是想知道,可以在一条语句中完成么?
    例如我使用jdbc执行了executeUpdate,可以在ResultSet里面获取它的值?