Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> add a new partition and drop old partition !!!
Hallo !
I have write a pl/sql-script. but i don't get a solution.
i want add a new partition. And from the new added partition make - 8
to find a old partition. when i find this partition drop this
partition.
my script:
declare
-- Local variables here
v_date_string VARCHAR2(20); v_part VARCHAR2(20); l_statement VARCHAR2(2000); v_create_part VARCHAR2(200); v_drop_part VARCHAR2(20); v_exists_part VARCHAR2(20); v_date VARCHAR2(20);
CURSOR context_date_cur IS
Select distinct ext_frontend.context_date
from ext_frontend
where context_date not in
(select substr(PARTITION_NAME,6,10)
from dba_tab_partitions where table_name='FRONTEND_TAB') order by
context_date asc;
v_date_add_part context_date_cur%ROWTYPE;
CURSOR exists_drop_partion_cur IS
select dba_tab_partitions.partition_name
from dba_tab_partitions;
v_date_drop_part exists_drop_partion_cur%ROWTYPE;
begin
-- Test statements here
IF NOT context_date_cur%ISOPEN
THEN
OPEN context_date_cur;
END IF;
loop
fetch context_date_cur into v_date_add_part;
exit when context_date_cur%NOTFOUND;
v_create_part :='part_'||v_date_add_part.context_date; v_date:=to_char(1+to_date(v_date_add_part.context_date,'dd.mm.yyyy'),'DD.MM.YYYY'); l_statement:= 'alter table FRONTEND_TAB
-----------------------------this section drop the finding partition,when not then go out from the for-
FOR v_date_drop_part in exists_drop_partion_cur
Loop
IF v_date_drop_part.partition_name='part_'||v_date
THEN
DBMS_OUTPUT.put_line(' Gefunden !!!');
ELSE
DBMS_OUTPUT.put_line('Nicht gefunden !!!');
End IF;
End Loop;
end loop;
end;
i think the problem in this statement IF v_date_drop_part.partition_name='part_'||v_date
????
Thank you for very much Received on Sat Oct 20 2007 - 07:50:05 CDT
![]() |
![]() |