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

相关推荐
薪火铺子3 分钟前
布隆过滤器原理与 Redis 防穿透实战
数据库·redis·缓存
网络工程小王6 分钟前
【LangGraph 子图(Subgraph)详解】学习笔记
java·服务器·数据库·人工智能·langchain
黄俊懿27 分钟前
复合索引设计指南:最左前缀 & 字段排座次
数据库·sql·mysql·adb·性能优化·dba·db
桃花键神41 分钟前
【2026精品项目】基于SpringBoot3+Vue3的旧物置换系统(包含源码+项目文档+SQL脚本+部署教程)
数据库·spring boot·sql·vue
.柒宇.1 小时前
Redis高频面试题与跳跃表原理详解
数据库·redis·缓存
Bryce学亮1 小时前
股票数据成本分析工具
数据库
思麟呀1 小时前
MySQL表的约束
数据库·mysql
步十人2 小时前
【FastAPI】ORM-02.使用 ORM 高效处理数据库逻辑
服务器·数据库·fastapi
Apache IoTDB2 小时前
时序数据库 IoTDB + 时序智能服务平台 TimechoAI 亮相中国核电信息技术高峰论坛
数据库·时序数据库·iotdb
未若君雅裁2 小时前
Redis 和 MySQL 双写一致性:延迟双删、读写锁、MQ、Canal 怎么选?
数据库·redis·面试