On 4 Sep 2003 at 12:17, Csaba Nagy wrote:

> This problem would be easily solved if the current transaction would not
> be automatically rolled back on the failed insert. Given this, it would
> be as easy as trying the insert, and if fails, do the update.

That violates definition of a transaction. You need nested transaction which 
aren't there..

You can use a sequence to insert. If next value of sequence is more than value 
you have, probably somebody has inserted the value. Then modify it.

Or do a select for update. If it returns the error, there is no record. So 
insert, otherwise update.

It might still fail though but chances will be much less.

HTH

Bye
 Shridhar

--
Air Force Inertia Axiom:        Consistency is always easier to defend than 
correctness.


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to