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博客

相关推荐
淡定是个好东西42 分钟前
springboot连接高斯数据库(GaussDB)踩坑指南
数据库·gaussdb
追风赶月、44 分钟前
【Redis】哨兵(Sentinel)机制
数据库·redis·sentinel
悟能不能悟1 小时前
mysql的not exists走索引吗
数据库·mysql
明月与玄武1 小时前
Jmeter -- JDBC驱动连接数据库超详细指南
数据库·jmeter·配置jdbc连接
专注VB编程开发20年1 小时前
VB.NET关于接口实现与简化设计的分析,封装其他类
java·前端·数据库
vvilkim1 小时前
Redis持久化机制详解:保障数据安全的关键策略
数据库·redis·缓存
cooldream20091 小时前
信息安全的基石:深入理解五大核心安全服务
数据库·安全·系统架构师
大数据魔法师1 小时前
Redis(三) - 使用Java操作Redis详解
java·数据库·redis
noravinsc1 小时前
e.g. ‘django.db.models.BigAutoField‘.
数据库·django
IT光2 小时前
Redis 五种类型基础操作(redis-cli + Spring Data Redis)
java·数据库·redis·spring·缓存