partition name based on data [message #597938] |
Wed, 09 October 2013 06:02 |
|
guddu_12
Messages: 227 Registered: April 2012 Location: UK
|
Senior Member |
|
|
Dear All,
I have a range date partition table month wise which i want to truncate the partition and load for each month data i get from source.
How can i get the partion name based on data value.
e.g
source data
SALES_ID SALES_DT
1 01/02/2008
1 01/03/2008
1 01/04/2008
1 01/05/2008
target table has same structure as source but has more data but i want to delete only those which is coming from source if it is there in target and then load. so i want to get partition name so that i can truncate and load them.
|
|
|
Re: partition name based on data [message #597940 is a reply to message #597938] |
Wed, 09 October 2013 06:08 |
|
Michel Cadot
Messages: 68641 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
SQL> desc user_tab_partitions
Name Null? Type
-------------------------------- -------- ----------------------
TABLE_NAME VARCHAR2(30)
COMPOSITE VARCHAR2(3)
PARTITION_NAME VARCHAR2(30)
SUBPARTITION_COUNT NUMBER
HIGH_VALUE LONG
HIGH_VALUE_LENGTH NUMBER PARTITION_POSITION NUMBER
TABLESPACE_NAME VARCHAR2(30)
PCT_FREE NUMBER
PCT_USED NUMBER
INI_TRANS NUMBER
MAX_TRANS NUMBER
INITIAL_EXTENT NUMBER
NEXT_EXTENT NUMBER
MIN_EXTENT NUMBER
MAX_EXTENT NUMBER
PCT_INCREASE NUMBER
FREELISTS NUMBER
FREELIST_GROUPS NUMBER
LOGGING VARCHAR2(7)
COMPRESSION VARCHAR2(8)
NUM_ROWS NUMBER
BLOCKS NUMBER
EMPTY_BLOCKS NUMBER
AVG_SPACE NUMBER
CHAIN_CNT NUMBER
AVG_ROW_LEN NUMBER
SAMPLE_SIZE NUMBER
LAST_ANALYZED DATE
BUFFER_POOL VARCHAR2(7)
GLOBAL_STATS VARCHAR2(3)
USER_STATS VARCHAR2(3)
[Updated on: Wed, 09 October 2013 06:09] Report message to a moderator
|
|
|
|
|
|
|
Re: partition name based on data [message #597951 is a reply to message #597949] |
Wed, 09 October 2013 07:27 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
guddu_12 wrote on Wed, 09 October 2013 17:35
What is the syntax of truncate partition for.
ALTER TABLE table_name TRUNCATE PARTITION FOR(partitioning_column_value);
Quote:
alter table range_sales
truncate partition for(date '2000-02-15')
In the above example can i write month as well. where can i find the documented for the above syntax. the above example is by date wise but i want to do it month wise.
If you mention a date value for that range in the partition, it will trunctae the entire partition thus selected. Why do you want to just mention the month? How are you creating the range partition? What is your requirement?
|
|
|
|
|
|
|
Re: partition name based on data [message #597992 is a reply to message #597968] |
Wed, 09 October 2013 11:47 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
guddu_12 wrote on Wed, 09 October 2013 18:55my question is that the above syntax only takes date as a value or it can take something else as well
Guddu,
The syntax has it's own meaning. The example which I gave you, in that thread, the range partition was created on DATE. So, the PARTITION FOR clause has the same date value as an input. Understand that month is just a part of a complete date type. As explained above, whether you mention a particular date which belongs to a partition, it will truncate the entire range of that RANGE PARTITION INTERVAL.
|
|
|