Database Reference
In-Depth Information
■
We are using the date format
DD/MM/YYYY
in the
CREATE TABLE
statement to make this international.
If we used a format of
DD-MON-YYYY
, then the
CREATE TABLE
would fail with
ORA-01843: not a valid month
if the
abbreviation of January was not Jan on your system. the
NLS_LANGUAGE
setting would affect this. I have used the
three-character month abbreviation in the text and inserts, however, to avoid any ambiguity as to which component is
the day and which is the month.
Note
Figure
13-1
shows that Oracle will inspect the value of the
RANGE_KEY_COLUMN
and, based on that value, insert it
into one of the two partitions.
Figure 13-1.
Range partition insert example
The rows inserted were specifically chosen with the goal of demonstrating that the partition range is strictly
less
than
and not
less than or equal to.
We first insert the value
15-DEC-2013
, which will definitely go into partition
PART_1
.
We also insert a row with a date/time that is one second before
01-JAN-2014
—that row will also go into partition
PART_1
since that is
less than
01-JAN-2014
. However, the next insert of midnight on
01-JAN-2014
goes into partition
PART_2
because that date/time is not strictly less than the partition range boundary for
PART_1
. The last row obviously
belongs in partition
PART_2
since it is greater than or equal to the partition range boundary for
PART_1
and less than
the partition range boundary for
PART_2
.
We can confirm that this is the case by performing
SELECT
statements from the individual partitions:
EODA@ORA12CR1> select to_char(range_key_column,'dd-mon-yyyy hh24:mi:ss')
2 from range_example partition (part_1);