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!

To insert multiple rows by getting the values from the user

sakthifireOct 11 2010 — edited Oct 11 2010
Hi
I want to insert multiple rows into a table using user given values dynamically.

I am a beginner to PL/SQL. Below code is part of my big code. A_row_insert is 2 and A_count is 1 (initially). While i execute , it asks for input only once and insert the same data 2 times. I want to enter two different rows. Please guide/advise me on this.

while (A_count<=A_row_insert) loop

dbms_output.put_line('Enter the value for the row#'||A_count||' of the table '||v_req_tab_name||':');
begin

INSERT INTO customers (
customer# ,
lastname ,
firstname ,
address ,
city ,
state ,
referred ,
region
+)+
VALUES
+(+
+&customer,+
+'&lastname' ,+
+'&firstname' ,+
+'&address' ,+
+'&city' ,+
+'&state' ,+
+&referred ,+
+'&region'+
+);+
end;
A_count := A_count 1;+
end loop;

regards
Sakthivel
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 8 2010
Added on Oct 11 2010
4 comments
790 views