The DROP PROCEDURE statement is used to delete a stored procedure.
Syntax
DROP PROCEDURE [IF EXISTS] sp_name
Parameters
Parameter |
Description |
|---|---|
| IF EXISTS | Optional. If the stored procedure does not exist, it will not generate an error, but will only generate a warning. |
| sp_name | The name of the stored procedure to be deleted. You can use database_name.sp_name to specify the database. |
To delete a stored routine, the user must have the ALTER ROUTINE privilege.
If the stored routine does not exist, using the IF EXISTS clause can prevent an error from occurring and generate a warning, which can be viewed using SHOW WARNINGS.
Examples
Delete a stored procedure.
obclient> DROP PROCEDURE IF EXISTS proc_name;
Delete a stored procedure in a specified database:
obclient> DROP PROCEDURE IF EXISTS test_db.get_employee_list;
