gpt4 book ai didi

firebird - 如何使用单个查询从 Firebird 3.0 数据库中删除所有表?

转载 作者:行者123 更新时间:2023-12-03 23:52:09 28 4
gpt4 key购买 nike

我正在研究使用包含数百个表的 Firebird 3.0 数据库的 JSF 应用程序。我需要不时删除所有表。

我检查了这个查询:

DROP TABLE TABLE_NAME

但是使用此查询一次只能删除一个表,而且程序非常耗时,我可以用另一种方法将其删除吗?

最佳答案

您可以创建删除表的过程

create or alter procedure PRC_DROP_TABLES
as
declare variable TBL varchar(50);

begin
for select r.rdb$relation_name
from rdb$relation_fields r
where
r.rdb$system_flag=0 and r.rdb$view_context is null
-- and r.rdb$relation_name not containing '$' --uncomment and modify this if you what filter tables by condition
group by r.rdb$relation_name
into :tbl do
execute statement 'drop table '||:tbl;
end

关于firebird - 如何使用单个查询从 Firebird 3.0 数据库中删除所有表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56072948/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com