Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Please help with a siimple PL/SQL code

Re: Please help with a siimple PL/SQL code

From: John Blackburn <John.D.Blackburn_at_transport.qld.gov.au>
Date: 2000/09/20
Message-ID: <8q9b76$1168@inetbws1.citec.com.au>#1/1

actually, I think the problem is that you are trying to do a to_number on a variable which is already a number.

if you are trying to limit v_bonus to two decimal places, try :g_total := NVL(v_sal,0) * trunc(v_bonus, 2);  or
:g_total := NVL(v_sal,0) * round(v_bonus, 2);

John.

Eddie <edawad_at_hotmail.com> wrote in message news:K6Sx5.680$Dz6.252427_at_paloalto-snr1.gtei.net...
> 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 Wed Sep 20 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US