PLS-00103 遇到符号"number"



我正在尝试获取贷款余额负值的异常,但我得到了此错误。

过程 PRC_PAYMENTS 的错误:

行/列错误


8/11 PLS-00103:在期待其中一个时遇到符号"NUMBER" 以下内容: := .( @ % ; 符号":="替换为"数字"以继续。

create or replace procedure prc_payments(PLoanId in number,
PPayDate in date default sysdate, PAmount in number) is
Ex_Pay exception;
begin 
    insert into hr.payments (payment_id, loan_id, payment_date, payment_amount) values(seq_payments.nextval, PLoanId, PPayDate, PAmount);
    commit;
    loan_bal number(6);
    select l.loan_balance
    into loan_bal
    from hr.loans l
    where l.loan_id = PLoanId;
    if loan_bal < 0 then 
     raise Ex_Pay;
    end if;
    update hr.loans h       
    set h.loan_balance = (loan_bal - PAmount)
    where h.loan_id = PLoanId;
    commit; 
    exception
    when Ex_Pay then 
        raise_application_error(-20001, 'El abono no puede ser negativo');
end prc_payments;
/
show error

column payment_id format 99
column loan_id format 99
column payment_date format A8
column payment_amount format 9999
set linesize 100
set pagesize 100
select e.employee_id EMP, e.first_name || ' ' || e.last_name, l.loan_id ID_LOAN, p.payment_amount Payments
from hr.employees e, hr.loans l, hr.payments p
where e.employee_id = l.employee_id 
and l.loan_id = p.loan_id;

变量声明loan_bal number(6);的位置错误,应在begin之前定义,而不是错误文本中的第 8 行。

相关内容

  • 没有找到相关文章

最新更新