WEEKLY Partitions in 11g
A reader, May 31, 2017 - 12:25 pm UTC
Hi Connor,
Is there any way we can create INTERVAL Partitions on WEEKLY basis.
Both NUMTODSINTERVAL & NUMTOYMINTERVAL doesnt allow to do that.
June 01, 2017 - 2:27 am UTC
SQL> select NUMTODSINTERVAL(7,'DAY') from dual;
NUMTODSINTERVAL(7,'DAY')
---------------------------------------------------
+000000007 00:00:00.000000000
HIGH_VALUE comparision
A reader, October 27, 2017 - 12:18 pm UTC
Hi,
Please have a look at below table partitions.
TABLE_NAME PARTITION_NAME HIGH_VALUE
----------------- ---------------------- -----------------------------------------------------------------------------------
TB_TEST_PARTITION TB_TEST_PARTITION_2009 TO_DATE(' 2010-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
TB_TEST_PARTITION TB_TEST_PARTITION_2011 TO_DATE(' 2012-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
TB_TEST_PARTITION TB_TEST_PARTITION_2012 TO_DATE(' 2013-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
TB_TEST_PARTITION TB_TEST_PARTITION_2013 TO_DATE(' 2014-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
TB_TEST_PARTITION TB_TEST_PARTITION_2014 TO_DATE(' 2015-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
TB_TEST_PARTITION TB_TEST_PARTITION_2015 TO_DATE(' 2016-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
TB_TEST_PARTITION TB_TEST_PARTITION_2016 TO_DATE(' 2017-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
TB_TEST_PARTITION TB_TEST_PARTITION_2017 TO_DATE(' 2018-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN')
I want to build a query which will give me partition less than 2013 (i.e. TB_TEST_PARTITION_2012, TB_TEST_PARTITION_2011, TB_TEST_PARTITION_2009)
Problem which i am facing is all_tab_partitions.HIGH_VALUE is LONG datatype and its not allowing me to use any date function on it.
Couls you please help how to modify below select condition to make it work.
select a.owner, a.table_name, a.partitioning_type, t.partition_name, a.interval
from all_part_tables a, all_tab_partitions t
where a.owner in ('SCOTT')
and a.partitioning_type = 'RANGE'
and a.table_name not like 'BIN$%'
and a.interval is not null
and t.table_owner = a.owner
and t.table_name = 'TB_TEST_PARTITION'
and t.table_name = a.table_name
-----------------------------
and TO_CHAR((t.high_value - 1), 'YYYY') < 2013
-----------------------------
;
October 27, 2017 - 2:35 pm UTC
Thanks Connor!!
A reader, October 27, 2017 - 2:46 pm UTC