我该如何在Postgresql中删除存储过程?
DROP FUNCTION name(arguments);
我可以通过以下命令删除存储过程(Stored Procedure):
DROP PROCEDURE IF EXISTS <schema-name>.<procedure-name>(all-arguments);
示例:
DROP PROCEDURE IF EXISTS public.my_procedure(empname character varying);
即使没有参数名称,您也可以将其删除。
DROP FUNCTION IF EXISTS name;
PostgreSQL 11引入了存储过程。此外,它还添加了新的语法DROP ROUTINE:
DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
DROP ROUTINE removes the definition of an existing routine, which can be an aggregate function, a normal function, or a procedure.
DROP ROUTINE IF EXISTS foo(integer);
This command conforms to the SQL standard, with these PostgreSQL extensions:
The standard only allows one routine to be dropped per command.
The IF EXISTS option
The ability to specify argument modes and names
Aggregate functions are an extension.