我正在尝试使用 Invoice 表中的一些值来计算此函数中的应付余额。我不太确定计算线的确切位置。任何帮助将非常感激!
Create or Replace Function Get_balance_due(
f_invoice_id In Number)
Return Number
AS
balance_due Number;
f_invoice_total Number;
f_payment_total Number;
f_credit_total Number;
Begin
select (vendor_id into f_vendor_id,
invoice total into f_invoice_total,
payment_total into f_payment_total,
credit_total into f_credit_total)
From
invoices
Where
invoice_id = f_invoice_id
balance_due = f_invoice_total - f_payment_total - f_credit_total;
Return (balance_due);
End;
/
SHOW ERRORS Function Get_balance_due;