DROP FUNCTION
Removes a function.
Syntax
DROP FUNCTION [IF EXISTS] <name> ( [ [arg_mode] [arg_name] arg_type [, ...] ] )
[CASCADE | RESTRICT]
Parameters
-
IF EXISTS
If you include
IF EXISTS
in your command, no error will reported if the specified function does not exist. A notice will be issued instead. -
<name>
The name of the function. You can prefix the name with a schema name to remove the function from the specified schema.
-
<arg_mode>
The mode of the argument, which can be
IN
,OUT
,INOUT
, orVARIADIC
. If omitted, the default valueIN
will be used. You do not need to listOUT
arguments becauseDROP FUNCTION
uses only input arguments to identify the function. -
<arg_name>
The name of the argument.
Argument names are not necessary, since
DROP FUNCTION
does not use argument names to identify the function. -
<arg_type>
The data type of the argument. This parameter is required to identify the function since different functions with the same name can exist.
-
CASCADE
orRESTRICT
Whether to drop the function and its dependent objects if dependent objects exit. Supported options include:
CASCADE
: specifies to drop the dependent objects along with the function.RESTRICT
: specifies to reject the drop operation and is the default.
Examples
Remove the square root function:
DROP FUNCTION sqrt(integer);
SQL standard compatibility
Standard SQL does not support DROP FUNCTION
.