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