Skip to content

DROP FUNCTION

Grammar Description

The DROP FUNCTION statement indicates the deletion of user-defined functions.

Grammar Structure

> DROP FUNCTION <name> ([<arg_data_type> ]… )

Example

Example 1

--Delete the parameterized function

mysql> create function twosum (x float, y float) returns float language sql as 'select $1 + $2' ;
Query OK, 0 rows affected (0.02 sec)

mysql> drop function twosum(float,float);
Query OK, 0 rows affected (0.01 sec)

Example 2

--Delete the function without parameters
mysql> CREATE FUNCTION t1_fun () RETURNS VARCHAR LANGUAGE SQL AS 'select n1 from t1 limit 1' ;
Query OK, 0 rows affected (0.01 sec)

mysql> drop function t1_fun();
Query OK, 0 rows affected (0.01 sec)