1

这是程序:

create or replace procedure CHECK_INFO_ACTUAL_AMOUNT_UPD(
ACTUAL_AMOUNT IN CHECK_INFO.ACTUAL_AMOUNT%TYPE,
CHECK_INFO_ID IN CHECK_INFO.ID_CHECK_INFO%TYPE,
TOTAL_ADJUSTMENT IN CHECK_INFO.TOTAL_ADJUSTMENT_ACCRUEMENT%TYPE
) 
is
begin
  UPDATE CHECK_INFO C SET C.ACTUAL_AMOUNT = ACTUAL_AMOUNT,
  C.IS_ACCUMULATION_COMPLITED = 5,
  C.TOTAL_ADJUSTMENT_ACCRUEMENT = TOTAL_ADJUSTMENT 
  WHERE C.ID_CHECK_INFO = CHECK_INFO_ID;
  COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN
      DBMS_OUTPUT.PUT_LINE(SQLERRM);
      ROLLBACK;
end CHECK_INFO_ACTUAL_AMOUNT_UPD;

问题是当我通过传递参数时,程序不会更新 ACTUAL_AMOUNT 字段,但是当我在程序内部分配值时它会更新

...
UPDATE CHECK_INFO C SET C.ACTUAL_AMOUNT = 111,
...

我试图调试值以传递参数... 问题是什么???

4

1 回答 1

1

它不起作用,因为您使用相同的参数名称(ACTUAL_AMOUNT、ID_CHECK_INFO)。
为了避免混淆,您应该使用某种约定来命名程序参数,我使用p_它作为首字母。

试试这个:

create or replace procedure CHECK_INFO_ACTUAL_AMOUNT_UPD(
P_ACTUAL_AMOUNT IN CHECK_INFO.ACTUAL_AMOUNT%TYPE,
P_CHECK_INFO_ID IN CHECK_INFO.ID_CHECK_INFO%TYPE,
P_TOTAL_ADJUSTMENT IN CHECK_INFO.TOTAL_ADJUSTMENT_ACCRUEMENT%TYPE
) 
is
begin
  UPDATE CHECK_INFO C SET C.ACTUAL_AMOUNT = P_ACTUAL_AMOUNT,
  C.IS_ACCUMULATION_COMPLITED = 5,
  C.TOTAL_ADJUSTMENT_ACCRUEMENT = P_TOTAL_ADJUSTMENT 
  WHERE C.ID_CHECK_INFO = P_CHECK_INFO_ID;
  COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN
      DBMS_OUTPUT.PUT_LINE(SQLERRM);
      ROLLBACK;
end CHECK_INFO_ACTUAL_AMOUNT_UPD;
于 2012-09-20T05:16:06.900 回答