创建表及序列时,先判断其是否存在
1、创建表时,先判断表是否存在,如果存在则删除
create or replace procedure pr_droptable(
v_tablename in varchar2
)
as
v_count int;
begin
select count(1) into v_count from user_tables where table_name = upper(v_tablename);
if v_count > 0 then
execute immediate 'drop table ' || v_tablename;
end if;
end;
2、创建序列时,先判断序列是否存在,如果存在则删除
create or replace procedure pr_dropseq(
v_name in varchar2
)
as
v_count int;
begin
select count(1) into v_count from user_sequences a where sequence_name = upper(v_name);
if v_count > 0 then
execute immediate 'drop sequence ' || v_name;
end if;
end;