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: Merge Problem

Re: Merge Problem

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Fri, 25 Mar 2005 17:45:24 +0100
Message-ID: <42443fd1$0$859$626a14ce@news.free.fr>

"Anurag Varma" <avdbi_at_hotmail.com> a écrit dans le message de news:vsL0e.95816$vK5.92779_at_twister.nyroc.rr.com...
| Michel Cadot wrote:
| > "mike" <hillmw_at_charter.net> a écrit dans le message de
| > news:1111683445.671427.146550_at_o13g2000cwo.googlegroups.com...
| > | Most of the transactions 96% will be update transactions, so shouldn't
| > | we go ahead and try to update first, and then if it is not there do the
| > | insert?
| > |
| > | begin
| > | UPDATE mytable SET role = 'Super' where id='111111';
| > | exception when VAL_NOT_FOUND then
| > | Insert into mytable (id, role ) values ( '111111','Super' );
| > | end;
| > |
| > | So I need to replace dup_val_on_index with some other exception. Do
| > | you know what that exception is?
| > |
| > | Mike
| > |
| >
| > Your the one that knows the application.
| > Of course you should first try what is the most mikely to come.
| > The exception name is NO_DATA_FOUND.
| >
| > Regards
| > Michel Cadot
| >
| >

|

| probably:
|

| update mytable set role = 'Super' where id = '111111';
| if sql%rowcount = 0 then
| insert into mytable (id, role) values ('11111','Super');
| end if;
|

| .....

|
| Anurag

You're certainly right.

Regards
Michel Cadot Received on Fri Mar 25 2005 - 10:45:24 CST

Original text of this message

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