declare
l_str varchar2(100);
begin
for i in ( select partition_name ,high_value from user_tab_partitions where TABLE_NAME='AUDIT_TRAIL'
and interval='YES' and partition_name like 'SYS\_%' escape '\'
)
loop
execute immediate 'select to_char(' || i.high_value || ' - numtodsinterval(1, ''second''), ''"P"_yyyy_mm_dd'') from dual' into l_str;
execute immediate 'alter table AUDIT_TRAIL rename partition ' || i.partition_name || ' to ' || l_str;
dbms_output.put_line(l_str);
end loop;
end;
l_str varchar2(100);
begin
for i in ( select partition_name ,high_value from user_tab_partitions where TABLE_NAME='AUDIT_TRAIL'
and interval='YES' and partition_name like 'SYS\_%' escape '\'
)
loop
execute immediate 'select to_char(' || i.high_value || ' - numtodsinterval(1, ''second''), ''"P"_yyyy_mm_dd'') from dual' into l_str;
execute immediate 'alter table AUDIT_TRAIL rename partition ' || i.partition_name || ' to ' || l_str;
dbms_output.put_line(l_str);
end loop;
end;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27042095/viewspace-769689/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27042095/viewspace-769689/