最近想写一个存储过程实现更新数据这个简单的功能,却发现各种报错,请教论坛各位大神帮忙想想怎么实现最合适!表名:project_info
主键:proid
实现功能:
读取前台的传参传过来的proid值,在所有记录中查找该行记录,找到后按前台传过来的其他字段新值更新本条记录。Oracle存储

解决方案 »

  1.   

    create procedure pro_test(p_proid in number,p_other_col1 in varchar2,p_other_col2 in varchar2) asbegin
       update project_info set other_col1 = p_other_col1,other_col2 = p_other_col2
           where proid  = p_proid ;
       --commit;
    end;
      

  2.   

    这个应该很简单吧,居然会各种报错?楼上的写的就差不多了。。create or replace procedure p_update_project(i_proid in varchar2,
                                                 i_col1  in varchar2,
                                                 i_col2  in varchar2) asbegin
      update project_info
         set col1 = i_col1, col2 = i_col2
       where proid = i_proid;  commit;
    exception
      when others then
        dbms_output.put_line(sqlerrm);
    end;