我正在使用 Oracle 12c,并且在删除表“CONTINENT”时出现错误,以防万一它不存在,我对此并不感兴趣。
我做了这个
set echo on
set serveroutput on
alter session set current_schema=WORK_ODI;
set verify off
set pause off
begin
execute immediate 'drop table continent';
exception when others then null;
end;
这个脚本很适合我。我也使用这个脚本:
declare
c int;
begin
select count(*) into c from user_tables where table_name = upper('continent');
if c = 1 then
execute immediate 'drop table continent';
end if;
end;
这两个脚本都运行良好,但我的老板想要 IF EXIT
类的东西。任何人都可以帮助我。在这种情况下如何使用 IF EXIT ?
原文由 Abderrahim 发布,翻译遵循 CC BY-SA 4.0 许可协议