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: Optimizing SELECT Query

Re: Optimizing SELECT Query

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Thu, 04 Jul 2002 15:50:10 GMT
Message-ID: <3D246E8C.3C0880D6@exesolutions.com>


Carsten Grammes wrote:

> Hello world,
>
> following situation: I have a table T with a column C (C are numbers).
> I want to find the number which is smaller but nearest to a given
> value N.
>
> How to formulate this as a select statement in an efficient way?
>
> Thanks,
> Carsten.
>
> ---
> I want to die peacefully in sleep like my grandfather.
> Not screaming in terror like his passengers!

It is doable but has ugly written all over it. What is the definition of the numeric field? And please let it not be something like NUMBER(20,9).

There may be better ways: I hope there are because I would like to learn what it is. But my initial instinct would be to create a B*Tree using dynamic SQL in a loop.

Daniel Morgan Received on Thu Jul 04 2002 - 10:50:10 CDT

Original text of this message

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