Mushfique Khan
asked on
Oracle 11g Partition question ... TIMESTAMP (3) WITH LOCAL TIME ZONE
Hi folks,
Need to create a table, something like this:
create table ttest
(t_id number, TIMESTAMP TIMESTAMP (3) WITH LOCAL TIME ZONE)
partition by range(TIMESTAMP)
(
PARTITION nfl2_jul13 VALUES LESS THAN(TIMESTAMP '01-07-13 00:00:00 +0.00')
);
Please advice/assist, what I'm doing wrong here? Have tried couple of options ... :-(
Thanks in advance.
Need to create a table, something like this:
create table ttest
(t_id number, TIMESTAMP TIMESTAMP (3) WITH LOCAL TIME ZONE)
partition by range(TIMESTAMP)
(
PARTITION nfl2_jul13 VALUES LESS THAN(TIMESTAMP '01-07-13 00:00:00 +0.00')
);
Please advice/assist, what I'm doing wrong here? Have tried couple of options ... :-(
Thanks in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks slightwv ... it works, but when trying to do this, adding partitions for 1 year, getting this error:
create table ttest
(t_id number, TIMESTAMP TIMESTAMP (3) WITH LOCAL TIME ZONE)
partition by range(TIMESTAMP)
(
PARTITION ttest_jun13 VALUES LESS THAN(TIMESTAMP '01-07-13 00:00:00.00 +0:00'),
PARTITION ttest_jul13 VALUES LESS THAN(TIMESTAMP '01-08-13 00:00:00.00 +0:00'),
PARTITION ttest_aug13 VALUES LESS THAN(TIMESTAMP '01-09-13 00:00:00.00 +0:00'),
PARTITION ttest_sep13 VALUES LESS THAN(TIMESTAMP '01-10-13 00:00:00.00 +0:00'),
PARTITION ttest_oct13 VALUES LESS THAN(TIMESTAMP '01-11-13 00:00:00.00 +0:00'),
PARTITION ttest_nov13 VALUES LESS THAN(TIMESTAMP '01-12-13 00:00:00.00 +0:00'),
PARTITION ttest_dec13 VALUES LESS THAN(TIMESTAMP '01-01-14 00:00:00.00 +0:00'),
PARTITION ttest_jan14 VALUES LESS THAN(TIMESTAMP '01-02-14 00:00:00.00 +0:00'),
PARTITION ttest_feb14 VALUES LESS THAN(TIMESTAMP '01-03-14 00:00:00.00 +0:00'),
PARTITION ttest_mar14 VALUES LESS THAN(TIMESTAMP '01-04-14 00:00:00.00 +0:00'),
PARTITION ttest_apr14 VALUES LESS THAN(TIMESTAMP '01-05-14 00:00:00.00 +0:00'),
PARTITION ttest_may14 VALUES LESS THAN(TIMESTAMP '01-06-14 00:00:00.00 +0:00')
);
ORA-14037: partition bound of partition "TTEST_NOV13" is too high
when added using ALTER TABLE ... it worked, why this behavior?
Please advice ... and thanks again :-)
create table ttest
(t_id number, TIMESTAMP TIMESTAMP (3) WITH LOCAL TIME ZONE)
partition by range(TIMESTAMP)
(
PARTITION ttest_jun13 VALUES LESS THAN(TIMESTAMP '01-07-13 00:00:00.00 +0:00'),
PARTITION ttest_jul13 VALUES LESS THAN(TIMESTAMP '01-08-13 00:00:00.00 +0:00'),
PARTITION ttest_aug13 VALUES LESS THAN(TIMESTAMP '01-09-13 00:00:00.00 +0:00'),
PARTITION ttest_sep13 VALUES LESS THAN(TIMESTAMP '01-10-13 00:00:00.00 +0:00'),
PARTITION ttest_oct13 VALUES LESS THAN(TIMESTAMP '01-11-13 00:00:00.00 +0:00'),
PARTITION ttest_nov13 VALUES LESS THAN(TIMESTAMP '01-12-13 00:00:00.00 +0:00'),
PARTITION ttest_dec13 VALUES LESS THAN(TIMESTAMP '01-01-14 00:00:00.00 +0:00'),
PARTITION ttest_jan14 VALUES LESS THAN(TIMESTAMP '01-02-14 00:00:00.00 +0:00'),
PARTITION ttest_feb14 VALUES LESS THAN(TIMESTAMP '01-03-14 00:00:00.00 +0:00'),
PARTITION ttest_mar14 VALUES LESS THAN(TIMESTAMP '01-04-14 00:00:00.00 +0:00'),
PARTITION ttest_apr14 VALUES LESS THAN(TIMESTAMP '01-05-14 00:00:00.00 +0:00'),
PARTITION ttest_may14 VALUES LESS THAN(TIMESTAMP '01-06-14 00:00:00.00 +0:00')
);
ORA-14037: partition bound of partition "TTEST_NOV13" is too high
when added using ALTER TABLE ... it worked, why this behavior?
Please advice ... and thanks again :-)
sdstuber, commented on it.
The ansi timestamp literal has a specific format:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements003.htm#BABGIGCJ
Using the values you have, looks like you might have some overlaps but I didn't go through it line by line.
The ansi timestamp literal has a specific format:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements003.htm#BABGIGCJ
TIMESTAMP Literals The TIMESTAMP datatype stores year, month, day, hour, minute, and second, and fractional second values. When you specify TIMESTAMP as a literal, the fractional_seconds_precision value can be any number of digits up to 9, as follows
Using the values you have, looks like you might have some overlaps but I didn't go through it line by line.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Second, timestamps with local time zone are stored in a consistent manner so it is possible to use them as a partitioning clause, but the values inserted and selected will vary by the settings of the user session.
Is that what you really want?
That is, if I insert a value for 1-7-13 at 1:00am and somebody in a different time zone inserts a value for 1-7-13 2:00am those are actually two different values. Either, both or neither might be in the partition you defined.