create or replace procedure CREATESPLITETABLE(tableNums in number) is
cursor t_cursor is
select substr(table_name, 1, length(table_name)-1) new_table_name, table_name from tabs
where table_name like '%1' and table_name not like '%11';
c_row t_cursor % rowtype;
i number;
begin
for c_row in t_cursor loop
begin
i :=1;
loop
i :=i+1;
if i > tableNums then
exit;
end if;
COPYTABLE(c_row.table_name, c_row.new_table_name||i, i);
end loop;
end;
end loop;
end CREATESPLITETABLE;
oracle根据表名复制表结构存储过程
Oracle存储过程:拆分表创建
最新推荐文章于 2025-12-02 20:26:41 发布
该段代码定义了一个Oracle存储过程CREATESPLITETABLE,用于根据输入的tableNums参数将匹配特定模式的表拆分为多个表。它遍历满足条件的表名,使用游标处理,并通过COPYTABLE函数将每个原表拆分为tableNums指定数量的新表。
1800

被折叠的 条评论
为什么被折叠?



