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

Home -> Community -> Usenet -> c.d.o.server -> Re: Package Constants vs Literals

Re: Package Constants vs Literals

From: DA Morgan <damorgan_at_psoug.org>
Date: Fri, 20 Oct 2006 09:04:37 -0700
Message-ID: <1161360276.552895@bubbleator.drizzle.com>


klabu wrote:
> "joel garry"

>> See
>>

> http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:7832114438832
>> to see how to figure out if it works for your exact code.  Especially
>> note the first and Sept. 13, 2006 responses.

>
> 1st:: 10gR2
> 2nd: Yes, Know all about Tom's mantra on BV.
>
> Let me make it a bit more clear about what I'm asking about.
>
> I'm NOT taking about in the context of an "application"
> Just about AD_HOC SQL (or a view) some "programmer/analyst" would write....
>
> Is it a good practice to replace literal codes (i.e 'AWD','FBW','UEM')
> with pkg constants :
>
> create package our_business_costants
> is
> begin
> all_wheel_drive constant varchar2(30) := 'AWD' ;
> fly_by_wire constant varchar2(30) := 'FBW' ;
> unearned_extortion_money constant varchar2(30) := 'UEM' ;
> end ;
>
> select * from sometable
> where drivetype = our_business_costants.all_wheel_drive
> and avinoicstype = our_business_costants.fly_by_wire
> and fundsource = our_business_costants.unearned_extortion_money ;
>
> Bascially I'm talking about EASE OF UNDERSTANING for say a new employee who
> have no idea
> what codes are available and WTH they mean.

In the context of ad hoc SQL it really won't make any difference.

You are basically trading carpal tunnel syndrome ... type "our_business_costants.unearned_extortion_money" for the possibility of input errors.

The question I would ask is: How "constant" are your constants? You could be creating a maintenance nightmare.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Fri Oct 20 2006 - 11:04:37 CDT

Original text of this message

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