# 数据类型的隐式转换

1.建立测验例子以及主索引。
CREATE TABLE hideconv AS
SELECT to_char(ROWNUM) cserial, all_objects.*
FROM all_objects where rownum<=10000 ;

CREATE INDEX I_hideconv_to_number_cserial ON hideconv
(to_number(cserial)) ;

CREATE INDEX I_hideconv_cserial ON hideconv
(cserial) ;

Analyze Table hideconv Compute Statistics ;

2。试验：
set autotrace traceonly ;
select * from hideconv where cserial=100 ;
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=88)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'HIDECONV' (Cost=1 Card=1 Bytes=88)

2 1 INDEX (RANGE SCAN) OF 'I_HIDECONV_TO_NUMBER_CSERIAL' (NON-UNIQUE) (
Cost=1 Card=1)

Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
4 consistent gets
0 redo size
1202 bytes sent via SQL*Net to client
425 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
1 rows processed

select * from hideconv where cserial='100' ;

Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1 Card=1 Bytes=88)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'HIDECONV' (Cost=1 Card=1 Bytes=88)

2 1 INDEX (RANGE SCAN) OF 'I_HIDECONV_CSERIAL' (NON-UNIQUE) (Cost=1 Car
d=1)

Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
4 consistent gets
0 redo size
1202 bytes sent via SQL*Net to client
425 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
1 rows processed

• 博文量
3464
• 访问量
7171279