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: Package/Procedure

RE: Package/Procedure

From: Toepke, Kevin M <ktoepke_at_trilegiant.com>
Date: Wed, 17 Apr 2002 07:48:25 -0800
Message-ID: <F001.0044688C.20020417074825@fatcity.com>


I always use the underscore and never mixed case. The reasoning? When i DESCRIBE a package/procedure/function in SQL*Plus, everything comes out uppercase. Using the "_" makes the names a little more readable

PKGTABLEALIAS	vs	PKG_TABLE_ALIAS
PMYPROCEDURE	vs	P_MY_PROCEDURE
FMYFUNCTION		vs	F_MY_FUNCTION
CMYCURSOR		vs	C_MY_CURSOR
FDONTREAD		vs	F_DO_NT_READ

Not that I've seen things like the last example...used incorrectly to cause invalid data in production.

Caver

-----Original Message-----
Sent: Wednesday, April 17, 2002 10:38 AM To: Multiple recipients of list ORACLE-L

Laura,

I use the prefixes pkg, p, f, and c to denote packages, procedures, functions, and cursors, respectively. I also use mixed case and avoid using the underscore (I just hate having to type that!). Also I never have standalone procedures or functions - everything's in packages. Read on to see why.

pkgTableAlias
pMyProcedure
fMyFunction
cMyCursor

Most all my packages are for one table each, so the package name is the table alias. The package for the Employees table would be pkgEmpl (I use the first four letters of the table name and the first letter of each section of the table name, if underscores included). The package for Employee_History would be pkgEmplH. (Thanks to David Wendelken for giving me the table alias idea years ago.)

Each table-oriented package has a "generic" public cursor (cRow) that returns a record of Table%RowType and a public function (fRow) that returns a row of Table%RowType. They each have at least one input argument (iR) of Table%RowType to allow passing in any combination of column values for evaluation.

There are also at least 3 public record variables (rR, rR1, rR0) and 3 public table variables (tT, tT1, and tT0). The first two of each are to hold records passed to or returned by the cursor or function, the 0 one is used to nullify the first two ("reset"). Having these objects (and many more) set up for each table allows application-specific modules to use the table-specific packaged objects without having to declare them. It promotes central, reusable code.

It is a hassle to establish standards, but once done it drastically reduces coding effort and errors.

Jack



Jack C. Applewhite
Database Administrator/Developer
OCP Oracle8 DBA
iNetProfit, Inc.
Austin, Texas
www.iNetProfit.com
japplewhite_at_inetprofit.com
(512)327-9068

> -----Original Message-----
> From: Burton, Laura L. [SMTP:BurtonL_at_prismplus.com]
> Sent: Tuesday, April 16, 2002 3:25 PM
> To: Multiple recipients of list ORACLE-L
> Subject: Package/Procedure
>
> Is there a naming convention for procedures and/or packages?
>
> Thank you,
>
> Laura
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jack C. Applewhite
  INET: japplewhite_at_inetprofit.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).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Toepke, Kevin M
  INET: ktoepke_at_trilegiant.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 Wed Apr 17 2002 - 10:48:25 CDT

Original text of this message

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