DROP PROCEDURE
Synopsis
Use the DROP PROCEDURE
statement to remove a procedure from a database.
Syntax
drop_procedure ::= DROP PROCEDURE [ IF EXISTS ]
{ subprogram_name ( [ subprogram_signature ] ) }
[ , ... ] [ CASCADE | RESTRICT ]
subprogram_signature ::= arg_decl [ , ... ]
arg_decl ::= [ formal_arg ] [ arg_mode ] arg_type
drop_procedure
subprogram_signature
arg_decl
You must identify the to-be-dropped procedure by:
-
Its name and the schema where it lives. This can be done by using its fully qualified name or by using just its bare name and letting name resolution find it in the first schema on the search_path where it occurs. Notice that you don't need to (and cannot) mention the name of its owner.
-
Its signature. The subprogram_call_signature is sufficient; and this is typically used. You can use the full subprogram_signature. But you should realize that the formal_arg and arg_mode for each arg_decl carry no identifying information. (This is why it is not typically used when a function or procedure is to be altered or dropped.) This is explained in the section Subprogram overloading.
Semantics
-
An error will be thrown if the procedure does not exist unless
IF EXISTS
is used. Then a notice is issued instead. -
RESTRICT
is the default and it will not drop the procedure if any objects depend on it. -
CASCADE
will drop any objects that transitively depend on the procedure.
Examples
DROP PROCEDURE IF EXISTS transfer(integer, integer, dec) CASCADE;