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;