it works dandy for me - unless you've defined f_seasoncode as a string of course.
as long as f_seasoncode is a number (which you unfortunately didn't say :( .....), it will partition eliminate and as long as the index is "selective" (eg: where f_seasoncode = 1 returns a SMALL number of rows) - it would go for it:
ops$tkyte%ORA11GR2> drop table flat_table;
Table dropped.
ops$tkyte%ORA11GR2>
ops$tkyte%ORA11GR2> CREATE TABLE FLAT_TABLE
2 (
3 ID NUMBER,
4 F_YEARCODE number,
5 F_SEASONCODE number,
6 data char(200)
7 )
8 PARTITION BY RANGE ( F_YEARCODE )
9 (
10 PARTITION PART_1 VALUES LESS THAN(2007),
11 PARTITION PART_2 VALUES LESS THAN(2008),
12 PARTITION PART_3 VALUES LESS THAN(2009),
13 PARTITION PART_4 VALUES LESS THAN(2010),
14 PARTITION PART_5 VALUES LESS THAN(2011),
15 PARTITION PART_6 VALUES LESS THAN(2012),
16 PARTITION PART_7 VALUES LESS THAN(2013),
17 PARTITION PART_8 VALUES LESS THAN(2014)
18 ) ;
Table created.
ops$tkyte%ORA11GR2>
ops$tkyte%ORA11GR2> CREATE INDEX local_nonprefixed ON FLAT_TABLE ( F_SEASONCODE ) LOCAL;
Index created.
ops$tkyte%ORA11GR2>
ops$tkyte%ORA11GR2> set autotrace traceonly explain
ops$tkyte%ORA11GR2> select * from flat_table where f_yearcode = 2010 and f_seasoncode = 1;
Execution Plan
----------------------------------------------------------
Plan hash value: 1474341237
------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
------------------------------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 241 | 1 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE SINGLE | | 1 | 241 | 1 (0)| 00:00:01 | 5 | 5 |
|* 2 | TABLE ACCESS BY LOCAL INDEX ROWID| FLAT_TABLE | 1 | 241 | 1 (0)| 00:00:01 | 5 | 5 |
|* 3 | INDEX RANGE SCAN | LOCAL_NONPREFIXED | 1 | | 1 (0)| 00:00:01 | 5 | 5 |
------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("F_YEARCODE"=2010)
3 - access("F_SEASONCODE"=1)
Note
-----
- dynamic sampling used for this statement (level=2)
ops$tkyte%ORA11GR2> set autotrace off
however, if you have seasoncode as a string type, it will not be able to use the index - due to the implicit conversion (compare strings to strings, numbers to numbers, dates to dates - and never ever allow implicit conversions to happen!)
ops$tkyte%ORA11GR2> drop table flat_table;
Table dropped.
ops$tkyte%ORA11GR2>
ops$tkyte%ORA11GR2> CREATE TABLE FLAT_TABLE
2 (
3 ID NUMBER,
4 F_YEARCODE number,
5 F_SEASONCODE varchar2(5),
6 data char(200)
7 )
8 PARTITION BY RANGE ( F_YEARCODE )
9 (
10 PARTITION PART_1 VALUES LESS THAN(2007),
11 PARTITION PART_2 VALUES LESS THAN(2008),
12 PARTITION PART_3 VALUES LESS THAN(2009),
13 PARTITION PART_4 VALUES LESS THAN(2010),
14 PARTITION PART_5 VALUES LESS THAN(2011),
15 PARTITION PART_6 VALUES LESS THAN(2012),
16 PARTITION PART_7 VALUES LESS THAN(2013),
17 PARTITION PART_8 VALUES LESS THAN(2014)
18 ) ;
Table created.
ops$tkyte%ORA11GR2>
ops$tkyte%ORA11GR2> CREATE INDEX local_nonprefixed ON FLAT_TABLE ( F_SEASONCODE ) LOCAL;
Index created.
ops$tkyte%ORA11GR2>
ops$tkyte%ORA11GR2> set autotrace traceonly explain
ops$tkyte%ORA11GR2> select * from flat_table where f_yearcode = 2010 and f_seasoncode = 1;
Execution Plan
----------------------------------------------------------
Plan hash value: 1109107995
-----------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop |
-----------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 232 | 2 (0)| 00:00:01 | | |
| 1 | PARTITION RANGE SINGLE| | 1 | 232 | 2 (0)| 00:00:01 | 5 | 5 |
|* 2 | TABLE ACCESS FULL | FLAT_TABLE | 1 | 232 | 2 (0)| 00:00:01 | 5 | 5 |
-----------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("F_YEARCODE"=2010 AND TO_NUMBER("F_SEASONCODE")=1)
Note
-----
- dynamic sampling used for this statement (level=2)
ops$tkyte%ORA11GR2> set autotrace off