Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Please help with a siimple PL/SQL code
I believe the problem is with the format in line 10 Try :g_total := NVL(v_sal,0) * TO_NUMBER(v_bonus, '99.99'); change '.99' to '99.99'
Eddie.
"Arthur" <mechhunter_at_rocketmail.com> wrote in message
news:39ca34d1.46186328_at_news.iinet.net.au...
> 1 ACCEPT salary PROMPT 'Please enter the salary amount: '
> 2 ACCEPT bonus PROMPT 'Please enter the bonus percentage: '
> 3 VARIABLE g_total NUMBER
> 4 DECLARE
> 5 v_sal NUMBER(10);
> 6 v_bonus NUMBER(10);
> 7 BEGIN
> 8 v_sal := &salary;
> 9 v_bonus := &bonus;
> 10 :g_total := NVL(v_sal,0) * TO_NUMBER(v_bonus, '.99');
> 11 END;
> 12 /
> 13* PRINT g_total
>
> Please enter the salary amount: 10000
> Please enter the bonus percentage: 10
> old 5: v_sal := &salary;
> new 5: v_sal := 10000;
> old 6: v_bonus := &bonus;
> new 6: v_bonus := 10;
> DECLARE
> *
> ERROR at line 1:
> ORA-06502: PL/SQL: numeric or value error
> ORA-06512: at line 7
>
> Oops! forgot to add in subject title.
> Can someone please tell me why the error is point at line 7 - BEGIN ?
> I am lost.
> it's probably something simple I am not seeing.
>
> Arthur
>
Received on Tue Sep 19 2000 - 17:52:26 CDT
![]() |
![]() |