该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
特别是循环条件怎么写,里面的条件怎么理解。。
代码如下:
for v_sql in (select cmd, table_name
from (select 1 sort_no,
'alter table ' || table_name ||
' drop partition ' || partition_name || ' ' cmd,
begin_time,
table_name
from tac_frag_manager_fj
where begin_time + reserve_days - 6 * interval_days <
sysdate
-- and table_name in ('ALARM','MONTH','TOTAL','LIST')
union all
select 2 sort_no,
'alter table ' || table_name ||
' add partition ' || partition_name ||
' values less than (to_date(' || chr(39) ||
to_char(begin_time + reserve_days,
'yyyy-mm-dd hh24:mi:ss') || chr(39) || ',' ||
chr(39) || 'yyyy-mm-dd hh24:mi:ss' || chr(39) ||
')) tablespace ' || tablespace_name || ' ' cmd,
begin_time,
table_name
from tac_frag_manager_fj
where begin_time + reserve_days - 6 * interval_days <
sysdate
-- and table_name in ('ALARM','MONTH','TOTAL','LIST')
)
order by sort_no asc, begin_time asc) loop