>>Also, do I need to point to any particular partition when I insert the records?
You can, but there is no point, because if you attempt to insert data with the wrong value for that partition, oracle won't insert it.
Main Topics
Browse All Topicsmrjoltcola,
A couple of weeks ago, you have suggested the following;
1) Generate test data: For your case it is as simple as running some insert statements with keys that will go into different partitions.
2) Viewing the plan: Use autotrace. http://download.oracle.com
You said to find out whethert are working, it only takes 2 records inserted into different partitions, and tracing the query as above to know it is working.
Can you provide the exact syntax to insert 2 records into different partitions? Also, do I need to point to any particular partition when I insert the records?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I have created table partitions based on date field such as in the format of YYYY-MON-DD. Then, when I inserted date fields in the format of DD-MON-YYYY into my table and did the query, found that date field in the table at the right partition. Does it mean Oracle doesn't care what format you use to insert because it automatically convert it into the right format? Also, I have created the index partitions based on the same date field format. My question is how I suppose to know the partition index I have created work properly according to it's partition? How can I be sure that the index partitions that I created point to the right index partition when doing query?
>> when I inserted date fields in the format of DD-MON-YYYY into my table and did the query, found that date field in the table at the right partition.
>>Does it mean Oracle doesn't care what format you use to insert because it automatically convert it into the right format?
Oracle does care. If you don't give an explicit format when inserting dates, it will use NLS_DATE_FORMAT in your session. Otherwise, it is safer to always use TO_DATE(..., ...) to format your date explicitily. As long as Oracle converts it to a date, then the partitioning will take over and distribute it according to the range.
>>My question is how I suppose to know the partition index I have created work properly according to it's partition?
This goes back to your original question. View the execution plan. See this sample.
-- same table but with a locally partitioned primary key
drop table t_part;
create table t_part
(
id integer,
col varchar2(20),
ts timestamp,
constraint pk_t_part primary key(id)
using index local
)
partition by range(id)
(
partition r1000000 values less than (1000000),
partition r2000000 values less than (2000000),
partition r3000000 values less than (3000000)
)
;
insert into t_part values(1, 'in part r1000000', sysdate);
insert into t_part values(1000000, 'in part r2000000', sysdate);
insert into t_part values(2000000, 'in part r3000000', sysdate);
exec dbms_stats.gather_schema_s
set autotrace on
select * from t_part partition(r2000000) where id = 1000000;
-- The query returns one row.
ID COL TS
---------- -------------------- --------------------------
1000000 in part r2000000 03-NOV-09 11.21.12.000000 AM
-- And I see a plan generated that shows that it accessed the local index.
Business Accounts
Answer for Membership
by: mrjoltcolaPosted on 2009-11-02 at 21:23:20ID: 25726244
>>Can you provide the exact syntax to insert 2 records into different partitions?
Do you understand what exactly partitioning does? Oracle looks at the value of the column that match the table's partitioning key, and decided which partition to insert it into, based on that. That simple. You don't change the syntax of the insert from a standard table insert, just pick two different values for the column.
So if your table was partitioned on COL1, one partition for each letter in the alphabet, then:
insert into tab(col1, ...) values('A', ...); -- Oracle puts it in partition_a
insert into tab(col1, ...) values('Z', ...); -- Oracle puts it in partition_z (or whatever you named it)