Re: How do you name your triggers?

From: Robert C. Nix <rnix_at_us.oracle.com>
Date: 1996/01/08
Message-ID: <30F13E46.6AAF_at_us.oracle.com>#1/1


machl001_at_maroon.tc.umn.edu wrote:
>
> We are trying to set up a naming standard for triggers?
>
> Is there value in imbedding the type of trigger in the
> name? Such as update, insert, or delete? Or the fact
> that it is a before or after trigger? How about prefixing
> the name with a T_ to indicate that it is a trigger?

I prefix all of my triggers with T_<Where><Type>{FE}_<Table>

<Where> : B - Before
          A - After
<Type>  : I - Insert
          U - Update
          D - Delete

{FE} : optional - For Each Row
T_BUFE_EMP   - befre update for each row on emp
T_AD_DEPT    - after delete on dept
T_AIUDFE_EMP - after insert or update or delete for each row on emp

> Do people reference the triggering table in the trigger
> name or just give it a functional name as the base?

I almost always refernce the :new and :old records. What would be the purpose of a trigger that didn't?

Sometimes I use autosequencing:

before insert on tab1 for each row
begin

  • this is a huge performace hit for large tables select nvl(max(seqnum),0)+1 into :new.seqnum from tab1; end;

before update on tab1 for each row
begin

  • can add code to limit the update to DBAs only :new.seqnum := :old.seqnum; end;

> What are you doing?
>
> Thanks in advance for taking time to reply.
>
> Cherie Machler
> Database Consultant
> Data By Design, Inc.
>
> Cherie Machler
> machl001_at_maroon.tc.umn.edu
 

-- 
_________________________________________________
Robert C. Nix
Oracle Tools Support
rnix_at_us.oracle.com

DISCLAIMER:
The thoughts, opinions, remarks, suggestions, ...
expressed herein are my own and in no way should
be taken as a statement from Oracle Corporation.
I am NOT the voice of Oracle (not even close!).
Received on Mon Jan 08 1996 - 00:00:00 CET

Original text of this message