表名:AttentionCount
字段有: ---Id——GoodsSeq——-AttentionCount
分别代表:主键——商品ID——-----浏览量
现在需要 修个更新语句就是:修改浏览量:update 表名 set 浏览量=(查出原来的浏览量的基础上再加一)
存储过程中 我想到要传的参数就两个:GoodsSeq和AttentionCount
求大虾帮忙,用存储过程!谢谢(希望说的具体点,我是菜鸟!)

解决方案 »

  1.   

    create or replace procedure updateatt_pro(goodsseq varchar2,attentioncount number) is
    begin
      update AttentionCount set attentioncount = attentioncount + 1 where goodsseq = goodsseq;
      commit;
    end updateatt_pro;
      

  2.   


    create or replace procedure updateatt_pro(goodsseq number,attentioncount number) is
    begin
      -- 修改数据
      update AttentionCount set attentioncount = attentioncount + 1 where goodsseq = goodsseq;
      commit;
      -- 异常处理
      exception
      when others then
       rollback;
    end updateatt_pro;
      

  3.   

    参数名不要和数据库字段名一样,这样数据库会误认的。
     …… where goodsseq = goodsseq; 这样会更新掉所有的记录。