--检查表是否存在
function is_tab_exist(v_tab_name varchar2,v_dblink_name varchar2 default null) return boolean
as
n_count number default 0;
b_result boolean default false;
begin
--在用户表中查询
execute immediate 'select count(1) from user_tables'||case when v_dblink_name is not null then '@'||v_dblink_name end||' where table_name=upper('''||v_tab_name||''')' into n_count;
if n_count > 0 then
b_result := true;
end if;
return b_result;
exception
when others then return false;
end is_tab_exist;
检查表是否存在
最新推荐文章于 2022-07-13 15:22:40 发布
本文介绍了一个用于检查Oracle数据库中表是否存在的PL/SQL函数。该函数通过执行动态SQL语句来查询USER_TABLES视图,判断指定表名的表是否存在。
4569

被折叠的 条评论
为什么被折叠?



