--循環建立明日的表
loop
--抽取方法,檢查今天的表有無建立,若是沒有就建立
create_gps_day_table(current_datetime);
--抽取方法,檢查今天表序列是否建立,若是沒有就建立
create_gps_day_seq(current_datetime);
current_datetime := current_datetime+1;
--當中間天數小於結束月份天數跳出循環
exit when current_datetime>end_datetime;
end loop; sql
loop
execu_sql := 'alter table '||table_names||' add(datas clob)';
execute immediate execu_sql;
execu_sql := 'update '||table_names||' set datas = data';
execute immediate execu_sql;
execu_sql := 'alter table '||table_names||' drop column data';
execute immediate execu_sql;
execu_sql := 'alter table '||table_names||' rename column datas to data';
execute immediate execu_sql;
start_datetime := start_datetime+1;
exit when start_datetime>current_datetime;
end loop; 數據庫
loop
table_names := 'tb_app_time_'||start_datetime;
execu_sql := 'alter table '||table_names||' add(datas clob)';
execute immediate execu_sql;
start_datetime := start_datetime + 1;
exit when start_datetime>end_datetime;
end loop;
loop
table_names := 'tb_app_time_'||start_datetime;
execu_sql := 'update '||table_names||' set datas = data';
execute immediate execu_sql;
start_datetime := start_datetime+1;
exit when start_datetime>end_datetime;
end loop; mybatis