时间:2021-07-01 10:21:17 帮助过:47人阅读
在看字段的直方图时,高值和低值看不明白,需要转换一下,转换如下。 SQLgt; SELECT column_name, num_distinct n_d,
在看字段的直方图时,高值和低值看不明白,,需要转换一下,转换如下。
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月-05 7872021C0C152C 28-2月-14
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);
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;