Re: how to use plsql to calculate compond growth
Date: Mon, 29 Dec 2003 04:43:50 GMT
Message-ID: <3FEFB0A7.28DA63C5_at_yahoo.net>
David wrote:
>
> Hi Jim,
>
> Thank you for your help. I still got the same error message based on your code
>
> Any where wrong?
>
> Thanks
>
> David
>
> 1 declare
> 2 money number :=50000.00;
> 3 year number :=1;
> 4 begin for i in 1..17
> 5 loop insert into my_401k values(:year, :money + 0.1*:money);
> 6 year := year +1;
> 7 end loop;
> 8* end;
> nli_at_HOPE1> /
> SP2-0552: Bind variable "MONEY" not declared.
>
> ning_1898_at_yahoo.com (David) wrote in message news:<37032184.0312271915.d9d43ef_at_posting.google.com>...
> > I am learning plsql. I would like to run a stored procedure to
> > calculate my bank account value by predicted 10% annual growth rate.
> > Below is my plsql that is having problems. Your help is highly
> > appreciated.
> >
> > Thanks
> >
> > declare
> > money number := 50000.00;
> > year number := 1;
> > begin for i in 1..17
> > loop
> > execute immediate 'insert into my_401k values (':year', 'money + 0.10
> > * money')';
> > year := year + 1;
> > end loop;
> > end;
> > /
> >
> >
> > SP2-0552: Bind variable "YEAR" not declared.
> >
> > Any where wrong in this script?
> >
> > Thanks
Since this is a PL/SQL variable, does it need to be bound? What happens when you drop the semi-colons?
What I understand from bind variables is they are used to bind between the host environment (eg C, VB, SQL*Plus) and the SQL & PL/SQL environment. Flames for correction appreciated.
/Hans Received on Mon Dec 29 2003 - 05:43:50 CET