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: How to get column high_value and low_value?

Re: How to get column high_value and low_value?

From: Ram Srinivasan <srinivasanram2004_at_gmail.com>
Date: Wed, 17 Oct 2007 12:59:09 -0400
Message-ID: <9fc1ae810710170959k54ed1e63q4bf1dc54eb51150a@mail.gmail.com>


You can also try this:


/*********       Nth MAXIMUM   *******************************/

SELECT A.*
FROM ANALYSIS3 A
WHERE &N = (SELECT COUNT(DISTINCT(B.ANNUAL_2000))

               FROM ANALYSIS3 B
       WHERE A.ANNUAL_2000 <= B.ANNUAL_2000)

/***********************************************************************/

/*********       Nth MINIMUM    *******************************/

SELECT A.*
FROM ANALYSIS3 A
WHERE &N = (SELECT COUNT(DISTINCT(B.ANNUAL_2000))

               FROM ANALYSIS3 B
       WHERE A.ANNUAL_2000 >= B.ANNUAL_2000)

/***********************************************************************/
-- NOTES:  N=1 will return first MAX ir first MIN
--            N=2 will return second MAX or MIN.

-------------------------------------------------------



Ram Srinivasan

On 10/16/07, Greg Rahn <greg_at_structureddata.org> wrote:
>
> You can use dbms_stats.convert_raw_value(). It's probably easiest to
> wrap this with a function that takes the column and a data type as a
> string so you can use it directly on your select.
>
> On 10/16/07, Allen, Brandon <Brandon.Allen_at_oneneck.com> wrote:
> >
> >
> > I've googled and metalinked all the key words I can think of and can't
> find
> > any way to extract the actual high and low values for a column since the
> > values given in dba_tab_col_statistics are in an internal, raw format.
> >
> > Can anyone please tell me how to get the number or string values?
> >
> > I know I can get them out of a 10053 trace file, but I'm hoping there's
> an
> > easier way.
> >
> > Thanks,
> > Brandon
>
> --
> Regards,
>
> Greg Rahn
> http://structureddata.org
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

-- 
Sincerely
Ram Srinivasan
Charlottesville, VA.

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Oct 17 2007 - 11:59:09 CDT

Original text of this message

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