select a.table_owner, a.table_name, a.max_partition
from (select table_owner, table_name, max(partition_name) max_partition
from dba_tab_partitions
where table_owner not in ('SYS', 'SYSTEM')
and partition_name not in ('PMAXVAL', 'PMAX')
and table_name not in (select distinct table_name
from dba_tab_partitions
where interval = 'YES')
group by table_owner, table_name
order by 3) a