Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Prompting multiples times in PL/SQL??
qazmlp1209_at_rediffmail.com wrote:
> The Table format is as follows:
>
> SQL> desc MyTEST;
> Name Null? Type
> ----------------------------------------- --------
> ----------------------------
> NAME VARCHAR2(10 CHAR)
>
>
> I want to add 10 rows into this Table, with each row containing the
> 'name' that I want to enter.
> The following PL/SQL script does not work:
>
>
> ----------
> declare
> i number;
> begin
> for i in 1..10 loop
> insert into MyTEST(name) values ('&name');
> end loop;
> end;
> ----------
>
>
> It prompts for the 'name' only once and the same name figures in all
> the rows. But, I want to be prompted 10 times and each time I want to
> enter different 'name'. How exactly I should adapt the PL/SQL script
> for this?
In far less time you could have just written 10 insert statements.
A column named NAME?
SELECT keyword
FROM v$reserved_words
WHERE keyword = 'NAME';
Also do NOT declare the counter variables used in cursor loops.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Thu Jun 22 2006 - 12:43:36 CDT