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

相关推荐
薿夜12 分钟前
SpringSecurity(二)
数据库
Francek Chen32 分钟前
【大数据存储与管理】NoSQL数据库:01 NoSQL简介
大数据·数据库·分布式·nosql
Database_Cool_1 小时前
【无标题】
数据库·阿里云·ai
jnrjian1 小时前
with MATERIALIZE inline cardinality 联合使用 literals vs bind variables
oracle
isNotNullX1 小时前
BI如何落地?BI平台如何搭建?
大数据·数据库·人工智能
Shely20171 小时前
单表查询
数据库
5G丶1 小时前
ThinkPHP 集群部署完整指南
数据库·php
刘~浪地球2 小时前
数据库与缓存--MySQL 高可用架构设计
数据库·mysql·缓存
知识分享小能手2 小时前
MongoDB入门学习教程,从入门到精通,MongoDB的了解应用程序的动态(18)
数据库·学习·mongodb