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: Trigger to Prevent Update of Certain Columns

Re: Trigger to Prevent Update of Certain Columns

From: Edgar Weippl <weippl_at_acm.org>
Date: Thu, 24 Feb 2000 15:16:58 +0100
Message-ID: <38B53D5A.E3915B26@acm.org>


here's a trigger that does what you want.

jrcampbell_at_my-deja.com wrote:
>
> I am trying to prevent users from having the ability to update certain
> columns in a table, such as the UNIQUEID. My thought is to build a
> trigger that would replace the :new.UNIQUEID with the :old.UNIQUEID,
> etc....
>
> When I attempt to create the trigger I receive: "ORA-04082: NEW or OLD
> references not allowed in table level triggers"
>
> Any ideas?
>
> Here's my hack at it:
>
> accept officename prompt "Enter OfficeName In UPPERCASE: "
>
> spool create_&officename._divdata_trigger
>
> --*
> --create/replace the trigger
> --*
> create or replace trigger
> trg_&officename._divdata
> before
> update
> on
> &officename._divdata
> BEGIN
> if updating then

what does this line ??

> :new.mapoffice := :old.mapoffice,

i usually write
:new.mapoffice := :old.mapoffice; -- ; not ,

> :new.dmap := :old.dmap,
> :new.uniqueid := :old.uniqueid,
> :new.x := :old.x,
> :new.y := :old.y;
> end if;
> END;
> /
>
> spool off
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--

Edgar Weippl                                  mailto:weippl_at_acm.org
                                         http://www.acm.org/~weippl

PGP Fingerprint: F5FC 25AA 3AA1 7242 8F66 DD55 AFFE 0E46 F71E 571F Received on Thu Feb 24 2000 - 08:16:58 CST

Original text of this message

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