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: force inclusion of certain fields in update (trigger?)

Re: force inclusion of certain fields in update (trigger?)

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Thu, 21 Feb 2002 14:34:20 +0300
Message-ID: <a52lph$7ch$1@babylon.agtel.net>


if ?????? then => if not updating('USERNAME') then

--
Vladimir Zakharychev (bob@dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.


"Alexander Zimmer" <zimmer_at_hollomey.com> wrote in message
news:MPG.16dee3eacec89a93989680_at_news.cis.dfn.de...

> Problem:
>
> A table TABLE1 has 3 columnns:
> id number,
> text varchar(20),
> username varchar(10)
>
> Each time a row is updated, I want to force the user to include his
> username in the update.
>
> The following update would be illegal and should be rejected:
>
> update TABLE1
> set text='new text'
> where id=1;
>
> Whereas the following update would be legal:
>
> update TABLE1
> set text='new text', username='alex'
> where id=1;
>
> More precisely, table1 is a config table which is only updated manually
> and never by a program. So when a user updates this config table, I want
> to make sure that the field "username" contains the username of this
> updating user. Surely, I cannot force the user to include his *correct*
> name, he could be faking, but the point is just that I want to FORCE him
> to include the field username at all!
>
> How can this be achieved?
>
> Idea: in a trigger on the table TABLE1 a la:
>
> if inserting then
> if :new.username is null then
> -- do something ugly, e.g. throw an exception
> end if
> elsif updating then
> if ?????? then -- test whether the update field list
> -- contains the field "username"
> -- do something ugly, e.g. throw an exception
> end if
> end if
>
> So, how can the ?????? be solved?
>
> Any ideas?
>
> TIA,
> Alex
Received on Thu Feb 21 2002 - 05:34:20 CST

Original text of this message

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