oracle 格式化user_tab_col_ststistics(low_value,high_value)

fufuh2o發表於2010-01-05


SQL> col low_value format a10
SQL> col hight_value foramt a10
SP2-0158: unknown COLUMN option "foramt"
SQL> col hight_value for a10
SQL> select low_value,high_value from user_tab_col_statistics where table_name='T1';

LOW_VALUE  HIGH_VALUE
---------- ----------------------------------------------------------------
C102       C302

SQL> select max(a) from t1;

    MAX(A)
----------
     10000

SQL> select min(a) from t1;

    MIN(A)
----------
         1

SQL> select max(a),min(a) from t1;

    MAX(A)     MIN(A)
---------- ----------
     10000          1

SQL> show user
USER is "XH"

 

 

SQL> select utl_raw.cast_to_number(low_value) low,utl_raw.cast_to_number(high_value) hight from user_tab_col_statistics where table_name='T1';

       LOW      HIGHT
---------- ----------
         1      10000


or 用包
SQL> set serveroutput on
SQL>    declare
  2            a_low user_tab_col_statistics.low_value%type;
  3             a_high user_tab_col_statistics.high_value%type;
  4           aa t3.a%type;
  5             begin
  6       
  7         select low_value,high_value into a_low,a_high from user_tab_col_statistics where table_name='T3' and column_name='A' ;
  8         dbms_stats.convert_raw_value(a_low,aa);
  9         dbms_output.put_line(aa);
 10     dbms_stats.convert_raw_value(a_high,aa);
 11        dbms_output.put_line(aa);
 12       end;
 13 
 14  /
1
1000

PL/SQL procedure successfully completed.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12020513/viewspace-624281/,如需轉載,請註明出處,否則將追究法律責任。

相關文章