oracle 更新语句使用变量名代表列名

来源:互联网 发布:dbxpa处理器的软件 编辑:程序博客网 时间:2024/06/05 21:32

declare

      i_name varchar2(20);

     s varchar2(2000);

 

begin

     i_name := 'price';

     s :='update items set '||i_name||'=8.99 ' ||'where item_name=''Snow bee3''';

     executeimmediate s;

     commit;

     exceptionwhenothersthen

                    dbms_output.put_line(to_char(SQLCODE) ||' - ' ||SQLERRM);

end;

 

0 0
原创粉丝点击