Fwd: sql problem

  • From: Kerry Osborne <kerry.osborne@xxxxxxxxxxx>
  • To: "oracle-l@xxxxxxxxxxxxx Freelists" <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 16 Mar 2010 16:33:24 -0500

Yes, that's it. Sorry about that! It's quite a useful little function that I have used repeatedly.


Kerry Osborne
Enkitec
blog: kerryosborne.oracle-guy.com






Begin forwarded message:

From: Greg Rahn <greg@xxxxxxxxxxxxxxxxxx>
Date: March 16, 2010 4:07:27 PM CDT
To: kerry.osborne@xxxxxxxxxxx
Subject: Re: sql problem

You found it here:
http://structureddata.org/2007/10/16/how-to-display-high_valuelow_value-columns-from-user_tab_col_statistics/

No worries  :)

On Tue, Mar 16, 2010 at 1:47 PM, Kerry Osborne
<kerry.osborne@xxxxxxxxxxx> wrote:
Oops, just realized that script uses a function call display_raw (I think I
got that from Tim Gorman somewhere along the way). Anyway, here's the
definition of that function.
create or replace function display_raw (rawval raw, type varchar2)
return varchar2
is
   cn     number;
   cv     varchar2(32);
   cd     date;
   cnv    nvarchar2(32);
   cr     rowid;
   cc     char(32);
begin
   if (type = 'NUMBER') then
      dbms_stats.convert_raw_value(rawval, cn);
      return to_char(cn);
   elsif (type = 'VARCHAR2') then
      dbms_stats.convert_raw_value(rawval, cv);
      return to_char(cv);
   elsif (type = 'DATE') then
      dbms_stats.convert_raw_value(rawval, cd);
      return to_char(cd,'dd-mon-yyyy');
   elsif (type = 'NVARCHAR2') then
      dbms_stats.convert_raw_value(rawval, cnv);
      return to_char(cnv);
   elsif (type = 'ROWID') then
      dbms_stats.convert_raw_value(rawval, cr);
      return to_char(cnv);
   elsif (type = 'CHAR') then
      dbms_stats.convert_raw_value(rawval, cc);
      return to_char(cc);
   else
      return 'UNKNOWN DATATYPE';
   end if;
end;
/
Kerry Osborne
Enkitec
blog: kerryosborne.oracle-guy.com


Other related posts:

  • » Fwd: sql problem - Kerry Osborne