分区语句整理 2

-- 查找"分区维护表"中有这个表,但该表不存在或不是分区表

select *

  from lbidw.tb_sys_tab_partitions a

 where not exists (select 'a'

          from dba_tab_partitions b

         where b.table_owner in

               ('LBIDW', 'LBIMK', 'LBIKR')

           and upper(a.table_name) = b.table_name)

 

-- 查看现有的分区情况

select *

  from (select a.table_owner,

               a.table_name,

               a.partition_name,

               b.deal_cycle,

               case when b.deal_cycle = 'M' then substr(a.partition_name, length(a.partition_name) - 5, 6)

                    when b.deal_cycle = 'D' then substr(a.partition_name, length(a.partition_name) - 7, 8)

                end partition_date

          from dba_tab_partitions a, lbidw.tb_sys_tab_partitions b

         where a.table_owner in

               ('LBIDW', 'LBIMK', 'LBIKR', 'LBI_MALI_SOTELMA')

           and a.table_name = b.table_name

           and a.table_owner = upper(b.owner))

 where partition_date < '20100501'

   and deal_cycle = 'D'

--and table_owner <> 'LBIKR'

 order by table_owner asc, table_name asc, partition_date asc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值