PLS-00103 遇到符号“数字”
Posted
技术标签:
【中文标题】PLS-00103 遇到符号“数字”【英文标题】:PLS-00103 Encountered the symbol "number" 【发布时间】:2018-04-18 17:29:39 【问题描述】:我正在尝试获取贷款余额为负值的例外情况,但出现此错误。
PROCEDURE PRC_PAYMENTS 的错误:
行/列错误
8/11 PLS-00103:在期待其中之一时遇到符号“NUMBER” 以下: := 。 (@%; 符号“:=”被替换为“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;
【问题讨论】:
【参考方案1】:变量声明 loan_bal number(6);
的位置错误,应在 begin
之前定义,而不是错误文本中的第 8 行。
【讨论】:
就是这样!谢谢!以上是关于PLS-00103 遇到符号“数字”的主要内容,如果未能解决你的问题,请参考以下文章