Use display_raw to view the histogram of a field

Source: Internet
Author: User

When you look at the histogram of a field, you cannot see the values of high and low values. You need to convert the values as follows.

SQL> SELECT column_name,
Num_distinct n_d,
Low_value o_low_value,
Display_raw (low_value, data_type) low_value,
High_value o_high_value,
Display_raw (high_value, data_type) high_value
FROM user_tab_cols
WHERE table_name = 'T'
And (column_name = 'owner' or column_name = 'object _ id'
Or column_name = 'created ');


COLUMN_NAM N_D O_LOW_VALU LOW_VALUE O_HIGH_VAL HIGH_VALUE
--------------------------------------------------------
OWNER 22 4249 BI 584442 XDB
OBJECT_ID 51136 C103 2 C3071535 62052
CREATED 1395 7869081E0E3319 30-8 month-05 7872021C0C152C 28-2 month-14

Create or replace function display_raw (rawval raw, type varchar2)
Return varchar2
Is
Cn number;
Cv varchar2 (32 );
Cd date;
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 );
Elsif (type = 'varchar2') then
Dbms_stats.convert_raw_value (rawval, NV );
Return to_char (NV );
Elsif (type = 'rowid') then
Dbms_stats.convert_raw_value (rawval, cr );
Return to_char (NV );
Elsif (type = 'Char ') then
Dbms_stats.convert_raw_value (rawval, cc );
Return to_char (cc );
Else
Return 'unknown ype ';
End if;
End;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.