Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Naming Standards - Thoughts Needed

RE: Naming Standards - Thoughts Needed

From: Stephane Faroult <sfaroult_at_oriolecorp.com>
Date: Mon, 16 Jul 2001 02:31:47 -0700
Message-ID: <F001.0034ABB3.20010716023022@fatcity.com>

> IMHO the reason for prefixes/postfixes is so that dependent objects can be
> given a more 'natural' name, that relates it to the object it depends on.
> Therefore T_ is redundant because tables don't depend on anything, but V_,
> T_ etc _may_ not be. Similarly, in pl/sql, you often want a procedure
> parameter to be the value of a column on a table. You can't use the name of
> the column because that would cause problems in the sql statements that use
> the value, so the usual standard is to prefix all parameters with p_ and
> local variables with l_ or v_.
>
> BTW, TR_ is not generally sufficient - you may want to have more than one
> trigger on a table. I would use something like TAI_ = Trigger After Insert,
> TBIUD_ = Trigger Before Insert, Update or Delete, etc.
>

I fully subscribe to this. For triggers, it's even worse than this if you want to be exhaustive, because you may wish to indicate not only whether the trigger is a before or after trigger (or instead of ...), but also it it is fired once per statement or for each row. Currently (my own standards evolve over time) I tend to forget about AFTER or BEFORE, but postfix my triggers with _IUD_RTRG or _IUD_STRG, where I/U/D specifies whether it is fired by insert, update or delete and RTRG stands for row trigger and STRG for statement trigger.

Also, opinions may be different about this, but I prefer postfixing over prefixing. The reason is that when you query USER_OBJECTS and order by OBJECT_NAME you will find related objects (tables, indexes, triggers ...) grouped together. Prefixing would put the emphasis on the type, which can make sense as well, but since you already have USER_ or DBA_ views for each type I find it less necessary and I think that postfixing 'adds value' in a way.

Regards,

Stephane Faroult
Oriole
Corporation



Performance tools for Oracle ®
http://www.oriole.com/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriolecorp.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Jul 16 2001 - 04:31:47 CDT

Original text of this message

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