Re: "Transactions are bad, real bad" - discuss

From: Alfredo Novoa <alfredo_at_ncs.es>
Date: 30 Apr 2003 03:14:16 -0700
Message-ID: <e4330f45.0304300214.799edb54_at_posting.google.com>


"Mikito Harakiri" <mikharakiri_at_ywho.com> wrote in message news:<KLCra.5$735.322_at_news.oracle.com>...

> How about
>
> UPDATE (
> select a1.AccountOwner ao1, a1.Balance b1, a2.AccountOwner ao2,
> a2.Balance b2
> from Accounts as a1, Accounts as a2
> ) set b1 = b1 - 1000000, b2 = b2 + 1000000
> where ao1 = 'Paul Vernon' and ao2 = 'Jonathan Leffler'

Nice, but it does not work with all SQL DBMSs

What about?

update Accounts set Balance := Balance - 1000000   where AccountOwner = 'Paul Vernon',
update Accounts set Balance := Balance + 1000000   where AccountOwner = 'Jonathan Leffler';

It is a lot easier to understand.

Regards
  Alfredo Received on Wed Apr 30 2003 - 12:14:16 CEST

Original text of this message