create table t ( key, no, data )
partition by range(no)(
  partition p01 values less than(11)
, partition p02 values less than(21)
, partition p03 values less than(31)
, partition p04 values less than(41)
, partition p05 values less than(51)
, partition p06 values less than(61)
, partition p07 values less than(71)
, partition p08 values less than(81)
, partition p09 values less than(91)
, partition p10 values less than(maxvalue)
)
as
select lpad(rownum, 6, '0'), mod(rownum, 100)+1, lpad(rownum, 10, '0')
from   dual
connect by level <= 999999
;



explain plan for 
select count(*) from t where no between 30 and 50;

@?/rdbms/admin/utlxpls

explain plan for 
select count(*) from t where no between :a and :b;

@?/rdbms/admin/utlxpls


explain plan for 
select count(*) from t where no in (30, 50);

@?/rdbms/admin/utlxpls


create table n 
as
select level no
from   dual
connect by level <= 100;


explain plan for 
select /*+ leading(n) use_nl(t) */ * 
from   n, t
where  t.no = n.no;

@?/rdbms/admin/utlxpls



--  ε 
create table t ( key, no, data )
partition by range(no) subpartition by hash(key) subpartitions 16 (
  partition p01 values less than(11)
, partition p02 values less than(21)
, partition p03 values less than(31)
, partition p04 values less than(41)
, partition p05 values less than(51)
, partition p06 values less than(61)
, partition p07 values less than(71)
, partition p08 values less than(81)
, partition p09 values less than(91)
, partition p10 values less than(maxvalue)
)
as
select lpad(rownum, 6, '0'), mod(rownum, 50)+1, lpad(rownum, 10, '0') 
from   dual 
connect by level <= 999999;

explain plan for 
select count(*) from t where no between 30 and 50;

@?/rdbms/admin/utlxpls


explain plan for 
select count(*) from t where no between :a and :b;

@?/rdbms/admin/utlxpls


--  Ϸ 
alter session set sql_trace = true;

select * from t where no = 1 and key = '000100';

select * from t where no = 1 and to_number(key) = 100;

select * from t where no = 1 and key = 100;

select * from t where to_char(no) = '1' and key = 100;


