All pages
Powered by GitBook
1 of 1

Loading...

DROP PROCEDURE

The DROP PROCEDURE statement permanently removes a stored procedure and its associated privileges from the database.

Syntax

Description

This statement is used to drop a stored procedure. That is, the specified routine is removed from the server along with all privileges specific to the procedure. You must have the ALTER ROUTINE privilege for the routine. If the server system variable is set, that privilege and EXECUTE are granted automatically to the routine creator - see .

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

While this statement takes effect immediately, threads which are executing a procedure can continue execution.

Examples

IF EXISTS:

See Also

This page is licensed: GPLv2, originally from

DROP PROCEDURE [IF EXISTS] sp_name
SHOW CREATE PROCEDURE
  • SHOW PROCEDURE STATUS

  • Information Schema ROUTINES Table

  • automatic_sp_privileges
    Stored Routine Privileges
    SHOW WARNINGS
    DROP FUNCTION
    Stored Procedure Overview
    CREATE PROCEDURE
    ALTER PROCEDURE
    fill_help_tables.sql
    DROP PROCEDURE simpleproc;
    DROP PROCEDURE simpleproc;
    ERROR 1305 (42000): PROCEDURE test.simpleproc does not exist
    
    DROP PROCEDURE IF EXISTS simpleproc;
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    SHOW WARNINGS;
    +-------+------+------------------------------------------+
    | Level | Code | Message                                  |
    +-------+------+------------------------------------------+
    | Note  | 1305 | PROCEDURE test.simpleproc does not exist |
    +-------+------+------------------------------------------+