PL SQL 报告函数在调用“=”时显示错误的参数数量或类型

PL SQL Report function showing wrong number or types of arguments in call to '='

function CF_OP_QTYFormula return Number 
is 
  v_qty number(10); 
begin  
   select sum(L_QTY) 
     into v_qty 
     from purchase_01   
    where MONTH_YEAR = :P_MONTH_YEAR -1;   
   return v_qty; 
end;

首先,我很确定 MONTH_YEAR =: P_MONTH_YEAR -1;是错误的语法。运算符 =: 是错误的。正确的运算符是:=。

:P_MONTH_YEAR 参数的类型更改为数字。 (假设您已在外部将此参数定义为日期、varchar2 等)

最后我解决了这个问题并且它正在工作,我使用了下面的代码:

function CF_OP_QTYFormula return Number is 
    v_qty number(10); 
begin 
    select sum(L_QTY) 
    into v_qty 
    from purchase_01 
    where MONTH_YEAR = to_date(:PTO_MONTH_YEAR,'dd-mm-yyyy') -1; 
    return v_qty; 
end;