Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help! with adding to a table
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
![]() |
![]() |