Re: How to get column high_value and low_value?

  • From: "Ram Srinivasan" <srinivasanram2004@xxxxxxxxx>
  • To: greg@xxxxxxxxxxxxxxxxxx
  • Date: Wed, 17 Oct 2007 12:59:09 -0400

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@xxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxx> 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
> --
> //www.freelists.org/webpage/oracle-l
>
>
>


-- 
Sincerely
Ram Srinivasan
Charlottesville, VA.

Other related posts: