Re: Trigger while reading row?

From: Paul Vernon <paul.vernon_at_ukk.ibmm.comm>
Date: Mon, 4 Nov 2002 15:09:05 -0000
Message-ID: <aq62k4$suq$1_at_sp15at20.hursley.ibm.com>


Generalising this, the scenario is that you want to update the value of the database based on it's current value, but you do not know what that current value is and you do not want to use transactions (well, locking) to freeze the database between the UPDATE and subsequent (or prior) SELECT.

As I've been arguing in comp.databases.theory that (user visible) transactions are a bad idea, I'd like to suggest how, in principle, this problem should be addressed without resorting to transactions:

Simply by allowing any relational update update operation to return the value (after the update) of the database (or relvar).

E.g. L := (R := R UNION s)

Where L is a local relvar, R is a database relvar and s is some relational expression.

Follow-up to comp.databases.theory only please.

Regards
Paul Vernon
Business Intelligence, IBM Global Services

"Hemant Shah" <shah_at_typhoon.xnet.com> wrote in message news:apv4kf$jjq$1_at_flood.xnet.com...
>
> Folks,
>
> Is there a way to write a trigger while reading the table (no update)?
>
> Here is what I want to do:
>
> I would like to do a select on a table and get the current value of a
> column and then increment the value by one. The table contains only one
> row and one column.
>
> Right now I do a read for update so that the row is locked, increment the
> value by one and update the column. Is it possible to update column via
> trigger or something else while doing select without update.
>
> Thanks.
>
> --
> Hemant Shah /"\ ASCII ribbon campaign
> E-mail: NoJunkMailshah_at_xnet.com \ / ---------------------
> X against HTML mail
> TO REPLY, REMOVE NoJunkMail / \ and postings
> FROM MY E-MAIL ADDRESS.
> -----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
> I haven't lost my mind, Above opinions are mine only.
> it's backed up on tape somewhere. Others can have their own.
Received on Mon Nov 04 2002 - 16:09:05 CET

Original text of this message