cursor vc_table_info is --defind cursor vc_talbe_info
select t1.table_owner,
t1.table_name,
t1.partition_name,
case
when t2.deal_cycle = 'D' then
t2.partition_name || '_' ||
to_char(t2.partition_date, 'yyyymmdd')
when t2.deal_cycle = 'W' then
t2.partition_name || '_' ||
to_char(t2.partition_date + 7, 'yyyyiw')
else
t2.partition_name || '_' || to_char(t2.partition_date, 'yyyymm')
end as partition_name2
from all_tab_partitions t1, T_S_TAB_PARTITION t2
where t1.table_name = t2.table_name
order by t1.table_name, t1.partition_name;
l_table_info vc_table_info%rowtype;--difind cursor l_table_info