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: SQL help needed

RE: SQL help needed

From: Mark W. Farnham <mwf_at_rsiz.com>
Date: Tue, 11 Jul 2006 10:56:44 -0400
Message-ID: <KNEIIDHFLNJDHOOCFCDKMEOGIEAA.mwf@rsiz.com>


The simple relational technique for avoiding the long decode or case statement would be to create a table with "group name" and "group value" as columns and do the join. You'd probably want to index on group name, group value as a concatened index or else build it as an IOT. While building a decode or case statement in your code handles the problem, the code will be fragile in the sense that it will not handle the addition of a new group.

Regards,

mwf

PS: Hmmm, maybe adding a sequence increment of next power of 2 would be a useful Oracle enhancement....though I suppose incrementing by 1 and raising nextval to the power of two to create the next group value also works. Obviously this overall solution dies if you have more groups than Oracle can handle in powers of 2.

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]On Behalf Of David Boyd
Sent: Monday, July 10, 2006 2:51 PM
To: kennaim_at_gmail.com; mwf_at_rsiz.com; oracle-l_at_freelists.org Subject: RE: SQL help needed

Ken,

Thanks for your input. As you pointed out, I'll stay with the long SQL statement to eliminate overhead.

Dave

>From: "Ken Naim" <kennaim_at_gmail.com>
>Reply-To: <kennaim_at_gmail.com>
>To:
><kennaim_at_gmail.com>,<davidb158_at_hotmail.com>,<mwf_at_rsiz.com>,<oracle-l_at_freeli
sts.org>
>Subject: RE: SQL help needed
>Date: Mon, 10 Jul 2006 13:02:44 -0500
>
>Ignore my last email as I misread yours as I didn't consider that a long
>sql
>statement. The only other way would be to encompass that logic in a
>function
>but you would be adding a lot of overhead into the query due the context
>switches even if you made it deterministic.
>
>Ken Naim



Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
--
http://www.freelists.org/webpage/oracle-l


--
http://www.freelists.org/webpage/oracle-l
Received on Tue Jul 11 2006 - 09:56:44 CDT

Original text of this message

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