oracle-存在删除表-存储过程

CREATE OR REPLACE PROCEDURE DROPIFEXISTS(new_table IN varchar2)
    IS
    v_count number(10);
BEGIN
    SELECT count(*)
    INTO v_count
    FROM user_tables
    WHERE table_name = upper(new_table);
    IF v_count > 0
    THEN
        EXECUTE IMMEDIATE 'drop table ' || new_table || ' purge';
    END IF;
END DROPIFEXISTS;

 

你可能感兴趣的:(数据库)