i have been working with basic pl/sql and need solution for a simple scenario. Insert values to a table where the values are input by the user.
I came up with the following code but it just asks the user for values once and inserts the same value for all the times loop runs. Instead I want it to ask the user to input some value on each loop iteration. Please suggest the right way to do it. Here's my code:
declare
n number(2) := &n;
a abc.id%type;
b abc.name%type;
i number(2);
begin
for i in 1..n
loop
a := &a;
b := &b;
insert into abc values(a,b);
end loop;
end;
Here is the Table: abc(id, name)