Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Help! with adding to a table
how do i batch insert into a table with unique columns?
whenever it violates the unique constraint it throws the whole batch
sql block out
I just want the ones the rows that violate the unique constraint to fail
ie
if the table is people and the current data is
name
and the name column has the unique constraint and I do the insert
begin
insert into people values ('tom'); insert into people values ('norm'); insert into people values ('stinkass'); insert into people values ('mary');
the whole thing fails because of mary, the stupid bitch
I just want to insert if it can
the only solution that I have come up with so far is
begin
update people set name=name where name='mary';
if sql%notfound then insert into people values ('mary')
end if;
end;
but this way sucks because it makes me do an update with every insert
Please Email me at jon_at_2wrongs.com
Thanks for your hlep Received on Thu Sep 30 1999 - 00:44:50 CDT
![]() |
![]() |