oracle 查询非自增长分区的最大分区

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

posted @ 2018-03-19 13:24  钱若梨花落  阅读(299)  评论(0编辑  收藏  举报