You are here: Reference Information > SQL Reference Information > SQL Statements > DROP FUNCTION

DROP FUNCTION

DROP FUNCTION — remove a user defined function

Syntax

DROP FUNCTION [schema.]func_name[/num_arg] IF EXISTS
DROP FUNCTION IF EXISTS [schema.]func_name[/num_arg]

Description

DROP FUNCTION removes the definition of an existing function. If schema_name is not specified, an attempt will be made to drop a function with the specified func_name from the current schema. To execute this command the user must be the owner of the function. See CREATE FUNCTION to create a function.

Parameters

Example

Create a function. Drop the function.

USE USER
SET DELIMITER @
CREATE FUNCTION func_boolean1() 
         RETURNS STRING
AS 
         INSERT INTO tmp_table1 VALUES (True), (False), (Unknown), (Null); 
END_FUNCTION;
@
SET DELIMITER ;
 
SELECT func_boolean1() FROM DUAL;
 COLUMN1  
 -------
 TRUE  
 FALSE 
 <null>
 <null> 
 
DROP FUNCTION func_boolean1;
SELECT func_boolean1() FROM DUAL;
/* can't find FUNCTiON "USER.FUNC_BOOLEAN1" */