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 -> Re: using constants

Re: using constants

From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 29 Nov 2007 08:15:26 -0800
Message-ID: <1196352919.72956@bubbleator.drizzle.com>


Marten Lehmann wrote:
> Hello,
>
> currently, we are using strings like "pending" or "finished" in some
> tables to specify the state of certain jobs stored in these tables.
> These values are self-explaining. These columns are indexed, of course.
>
> But I guess, lookups of jobs with certain states would be much faster,
> if the states would be stored is integer values, e.g. pending = 1,
> finished = 2 and so on. However, these values wouldn't be
> self-explaining any more.
>
> As long as I'm working with Java, I could defined constants within a
> class, so instead of integer values, I could use constants like
> State.PENDING or State.FINISHED.
>
> Is it possible to create such constants directly in Oracle, so I can use
> them within SQL-queries like
>
> select * from jobs where state = State.PENDING
>
> ?
>
> Regards
> Marten

The chance of you having enough activity on these tables to be able to measure the difference between your strings and an integer is remarkably close to zero.

But, as with all things, test and see. My guess is any difference you find will be measured in milliseconds.

-- 
Daniel A. Morgan
Oracle Ace Director & Instructor
University of Washington
damorgan_at_x.washington.edu (replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Thu Nov 29 2007 - 10:15:26 CST

Original text of this message

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