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

Trigger to Prevent Update of Certain Columns

From: <jrcampbell_at_my-deja.com>
Date: Mon, 07 Feb 2000 16:01:26 GMT
Message-ID: <87mq8c$nla$1@nnrp1.deja.com>


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
:new.mapoffice := :old.mapoffice,
: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. Received on Mon Feb 07 2000 - 10:01:26 CST

Original text of this message

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