Oracle数组循环表存在则删除

declare

type v_arr is table of varchar2(40) index by binary_integer;

list v_arr;

existing_table number;

v_sql varchar2(200);

begin

existing_table := 0;

list(1) := 'table1';

list(2) := 'table2';

for i in 1..list.count loop

select count(*) into existing_table from all_tables where table_name=list(i) and owner='root';

if existing_table = 1 then

v_sql := 'drop table '||list(i);

execute immediate v_sql;

end if;

end loop;

commit;

end;

参考了:oracle使用数组变量,[转]Oracle数组的使用-CSDN博客

相关推荐
豆芽脚脚5 小时前
MongoDB 导出和导入完整指南
数据库·mongodb
烧饼Fighting5 小时前
Mysql替换为瀚高数据库部分函数转换V4.5版本
数据库·mysql
上善若水_厚德载物6 小时前
Centos7 Mysql 5.7 读写分离
数据库·mysql
Mr__Miss6 小时前
Redis的持久化
数据库·redis·缓存
CCPC不拿奖不改名6 小时前
SQL基础(SQL小白教程):MySQL语句+环境一键搭建+面试习题
数据库·sql·计算机网络·mysql·oracle·面试·职场和发展
陈文锦丫7 小时前
JAVA面试
数据库·mysql
sunfove7 小时前
将 Python 仿真工具部署并嵌入个人博客
开发语言·数据库·python
冰清-小魔鱼8 小时前
各类数据存储结构总结
开发语言·数据结构·数据库
深藏bIue9 小时前
MongoDB 4.4.30安装、数据迁移
数据库·mongodb
benyuanone9 小时前
MySQL环境项目迁移成国产化达梦环境
数据库·mysql