Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to insert multiple rows in a table by user input ( pl/sql)

786451Jul 21 2010 — edited Jul 21 2010
hi,
I've been trying to insert multiple rows in a table from user input by some pl/sql, but failed every time. :/
what happens is that the program suppose to ask the user every time for new value but the loop
actually inserts the 1st values four times ( the loop is ran four times ). can any one point out what i'm
doing wrong or some solutions will be nice ;)

here what i wrote

---------------------------------

set serveroutput on
set verify off

declare

empno number;
empname varchar2(20);

begin

for i in 1..4 loop
empno:=&empno;
empname:='&empname';

insert into employee values(empno,empname);

end loop;

end;

-------------------------------

dont laugh at my code, i'm new to this oracle :D

thanks, looking forward for some reply
This post has been answered by BluShadow on Jul 21 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2010
Added on Jul 21 2010
11 comments
6,433 views