从SQL Developer运行更新,结果与软件包不同

时间:2019-04-09 10:02:43

标签: sql oracle plsql oracle-sqldeveloper

我试图在plsql过程的游标('cur_palettenkosten')操作中运行更新。

我缩小范围,即包围的游标包含数据,并且更新不影响任何行(输出sql%rowcount)


PROCEDURE p_ref_lschein_rueckstellungen AS

 for cur_palettenkosten in (
    select land, spediteur_nr, plz_von, plz_bis,  preis, gueltig_von, geultig_bis, gzp.behaelter_nr
    from spediteur_fahrtkosten sp,gutschrift_zuord_pal gzp 
    where sp.behaelter_nr = 1 
    )

    LOOP

        UPDATE lschein_rueckstellungen
           SET preis = cur_palettenkosten.preis
          WHERE to_number(sped_nr) = to_number(cur_palettenkosten.spediteur_nr) 
           AND to_number(lhm_typ) = to_number(cur_palettenkosten.behaelter_nr)
           AND to_char(kst) = to_char(cur_palettenkosten.land);

        dbms_output.put_line (cur_palettenkosten.spediteur_nr || ' '||cur_palettenkosten.behaelter_nr|| ' '|| cur_palettenkosten.land || sql%rowcount);

    END LOOP;
COMMIT;

END p_ref_lschein_rueckstellungen;

以这种方式从编辑器运行脚本:

BEGIN
    p_ref_lschein_rueckstellungen;
END

对我要更新的表'lschein_rueckstellungen'没有任何影响。

从同一编辑器窗口运行它,如下所示:

BEGIN
    <procedure content copied here>
END

根据需要更新数据。

有什么想法,我做错了什么吗?

1 个答案:

答案 0 :(得分:1)

是否可以在每个标签页中打开一个新会话?然后,您当然必须提交更新!