📜  oracle drop type if exists - SQL 代码示例

📅  最后修改于: 2022-03-11 15:05:08.549000             🧑  作者: Mango

代码示例1
DECLARE
    existing_type number;
BEGIN
    SELECT count(*) into existing_type
    FROM ALL_TYPES
    WHERE TYPE_NAME = 'type_name' AND OWNER = 'schema_name';
    IF existing_type = 1 then
        EXECUTE IMMEDIATE 'DROP TYPE schema_name.type_name';
    END IF;
END;