Re: why this error in SQL*Plus worksheet ??

From: Robert Malikian <robertmalikian_at_hotmail.com>
Date: Sun, 2 Dec 2001 08:20:23 -0800
Message-ID: <3c09e3e2_at_news1.homechoice.co.uk>


You need to rap your code in a BEGIN and finish it by END; and maybe you will need DECLARE as well on top.
DECLARE #First try it without
BEGIN
 for num in 1..500
 loop
   insert into mydb.message(messageid,message)     values(mydb.db_sq_counter.nextval,'test');  end loop;
END;
/
Robert
"Forrest Cicogni" <fcicogni_at_sageasset.com> wrote in message news:1007258188.119077_at_news...
> I didn't have time to test this, but the loop is badly formed. Also, make
> sure NUM is defined as a variable.
>
> for num in 1..500
> loop
> insert into mydb.message(messageid,message)
> values(mydb.db_sq_counter.nextval,'test');
> end loop;
>
>
> "KK" <moditha_at_yahoo.com> wrote in message
> news:469d2479.0112011743.6c7bf78c_at_posting.google.com...
> > I am a newbie to Oracle, so pardon if these questoins seems to be
> > stupid.
> > I connected to my database using SQL*Plus tool and issued the
> > following sql statements..
> >
> >
> > for num in 1..500 loop
> > insert into mydb.message(messageid,message)
> > values(mydb.db_sq_counter.nextval,'test');
> > end loop;
> >
> > it should add 500 rows to the message table. but the message i get is
> >
> >
> > SP2-0734: unknown command beginning "for num in..." - rest of line
> > ignored.
> > 1 row created.
> > SP2-0042: unknown command "end loop" - rest of line ignored.
> >
> > only one row get inserted at a time... where i have gone wrong?
> >
> > Regards
> > KK
>
>
Received on Sun Dec 02 2001 - 17:20:23 CET

Original text of this message