All pages
Powered by GitBook
1 of 1

Loading...

DROP FUNCTION

The DROP FUNCTION statement removes a stored function from the database, deleting its definition and associated privileges.

Syntax

Description

The DROP FUNCTION statement is used to drop a or a user-defined function (UDF). That is, the specified routine is removed from the server, along with all privileges specific to the function. You must have the ALTER ROUTINE for the routine in order to drop it. If the server system variable is set, both the ALTER ROUTINE and EXECUTE privileges are granted automatically to the routine creator - see .

IF EXISTS

The IF EXISTS clause is a MySQL/MariaDB extension. It prevents an error from occurring if the function does not exist. ANOTE is produced that can be viewed with .

For dropping a (UDF), see .

Examples

See Also

This page is licensed: GPLv2, originally from

DROP FUNCTION [IF EXISTS] f_name
ALTER FUNCTION
  • SHOW CREATE FUNCTION

  • SHOW FUNCTION STATUS

  • Stored Routine Privileges

  • INFORMATION_SCHEMA ROUTINES Table

  • stored function
    privilege
    automatic_sp_privileges
    Stored Routine Privileges
    SHOW WARNINGS
    user-defined functions
    DROP FUNCTION UDF
    DROP PROCEDURE
    Stored Function Overview
    CREATE FUNCTION
    CREATE FUNCTION UDF
    fill_help_tables.sql
    DROP FUNCTION hello;
    Query OK, 0 rows affected (0.042 sec)
    
    DROP FUNCTION hello;
    ERROR 1305 (42000): FUNCTION test.hello does not exist
    
    DROP FUNCTION IF EXISTS hello;
    Query OK, 0 rows affected, 1 warning (0.000 sec)
    
    SHOW WARNINGS;
    +-------+------+------------------------------------+
    | Level | Code | Message                            |
    +-------+------+------------------------------------+
    | Note  | 1305 | FUNCTION test.hello does not exist |
    +-------+------+------------------------------------+