Reputation: 75
On running the following code I'm getting this as output:
OUTPUT:- ORA-00001: unique constraint (KART.SYS_C007206) violated
I think I'm inserting batch of values at a time in database. Maybe that's why it's not working.
<!-- declare
Enter_the_size_of_array int;
id int;
name varchar(30);
age int
c int;
procedure s(a in out int , b in out varchar2,c in out int) is
begin
insert into table1 values(a,b,c);
end;
begin
c:=1;
Enter_the_size_of_array:= :Enter_the_size_of_array;
loop
id:= :id;
name:= :name;
age:= :age;
s(id,name,age);
c:=c+1;
exit when (c=Enter_the_size_of_array);
end loop;
end;
/ -->
Upvotes: 1
Views: 818
Reputation: 26
Kumar, it looks like in every iteration of the loop, ID (and all of the other values) stay the same. Its more than likely that you have a constraint on one or more columns (such as a primary key on ID) and you're just trying to insert the same values over and over again.
Upvotes: 1
Reputation: 2862
Assuming ID is a unique key field. every time you have enter the same value for ID. it throws unique key constraint exception.
Upvotes: 0