Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Help! with adding to a table

Help! with adding to a table

From: Jonathan Kilberg <jon_at_2wrongs.com>
Date: Thu, 30 Sep 1999 05:44:50 GMT
Message-ID: <mNCI3.76$mu2.15418@typhoon1.gnilink.net>


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



joe
mary

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');

end;

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US