1.创建procedure
create or replace procedure proc_dropifexists(p_table in varchar2) is v_count number(10);
begin
select count(*) into v_count from user_tables where table_name = upper(p_table); if v_count > 0 then execute immediate 'drop table '||p_table||' purge'; end if; end proc_dropifexists;
2.使用时
--delete test_table
call proc_dropifexists('test_table');
--create test_table
CREATE TABLE test_table( id number(12) primary key, testname varchar(100) NOT NULL );