DECLARE
V_NUM NUMBER;
BEGIN
SELECT COUNT(*)
INTO V_NUM
FROM USER_OBJECTS
WHERE OBJECT_NAME = 'XYZ'
AND OBJECT_TYPE = 'PROCEDURE';
IF V_NUM > 0 THEN
EXECUTE IMMEDIATE 'DROP PROCEDURE XYZ';
DBMS_OUTPUT.PUT_LINE('Dropped');
END IF;
END;
/
declare
c int;
begin
select count(*) into c from user_procedures where object_type = 'FUNCTION' and object_name = 'ABC';
if c = 1 then
execute immediate 'DROP FUNCTION ABC';
end if;
end;
4条答案
按热度按时间lztngnrs1#
如果您的目标是消除脚本中的错误消息,则可以尝试
ars1skjm2#
您还可以在以下之前检查字典视图:
hivapdat3#
我的解决方案:
fcy6dtqo4#
完整示例: