ops$tkyte@ORA9IR2> alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss';
Session altered.
ops$tkyte@ORA9IR2> drop table t;
Table dropped.
ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> create table t as select * from all_users;
Table created.
ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> analyze table t compute statistics;
Table analyzed.
ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> begin
2 print_table( '
3 select st.table_name
4 ,st.column_Name
5 ,st.num_distinct ndv
6 ,st.density
7 ,decode(tc.data_type,''NUMBER'',to_char(utl_raw.cast_to_number(st.low_value))
8 ,''VARCHAR2'',utl_raw.cast_to_varchar2(st.low_value)
9 ,''DATE'',
10 (to_number(substr( st.low_value, 1, 2 ), ''xx'' )-100)*100+
11 (to_number(substr( st.low_value, 3, 2 ), ''xx'' )-100)|| ''/'' ||
12 to_number(substr( st.low_value, 5, 2 ), ''xx'' ) || ''/'' ||
13 to_number(substr( st.low_value, 7, 2 ), ''xx'' ) || '' '' ||
14 (to_number(substr( st.low_value, 9, 2 ), ''xx'' )-1) || '':'' ||
15 (to_number(substr( st.low_value,11, 2 ), ''xx'' )-1) || '':'' ||
16 (to_number(substr( st.low_value,13, 2 ), ''xx'' )-1)
17 ,''Hi'') lo
18 , st.high_value hi
19 ,st.num_buckets bkts
20 from user_tab_col_statistics st
21 ,user_tab_columns tc
22 where st.table_name in (''T'')
23 and st.table_name=tc.table_name
24 and st.column_name=tc.column_name
25 ' );
26 end;
27 /
.TABLE_NAME : T
.COLUMN_NAME : USERNAME
.NDV : 43
.DENSITY : .0232558139534884
.LO : ANONYMOUS
.HI : 61
.BKTS : 1
-----------------
.TABLE_NAME : T
.COLUMN_NAME : USER_ID
.NDV : 43
.DENSITY : .0232558139534884
.LO : 0
.HI : C20247
.BKTS : 1
-----------------
.TABLE_NAME : T
.COLUMN_NAME : CREATED
.NDV : 33
.DENSITY : .0303030303030303
.LO : 2002/5/12 16:47:39
.HI : 7868071E10240D
.BKTS : 1
-----------------
PL/SQL procedure successfully completed.
ops$tkyte@ORA9IR2>
ops$tkyte@ORA9IR2> select created, dump(created,16) from (select min(created) created from t);
CREATED
--------------------
DUMP(CREATED,16)
-------------------------------------------------------------------------------
12-may-2002 16:47:39
Typ=12 Len=7: 78,66,5,c,11,30,28
that'll get most reasonable dates (BC, not.... need more math for that)..</code>
http://docs.oracle.com/cd/A57673_01/DOC/api/doc/OCI73/ch3.htm#3-ex-date <code>