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 -> Re: Help! with adding to a table

Re: Help! with adding to a table

From: Michel Cadot <micadot_at_netcourrier.com>
Date: Thu, 30 Sep 1999 10:14:35 +0200
Message-ID: <7sv66o$kh3$1@oceanite.cybercable.fr>


Just suppress begin and end and each statement will be handled as a separate statement.
Begin and end allow you to handle several statements as a whole which must be entirely correct else none of the statements is taken into account.

Regards

Michel

Jonathan Kilberg <jon_at_2wrongs.com> a écrit dans le message : mNCI3.76$mu2.15418_at_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 - 03:14:35 CDT

Original text of this message

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