The DROP PROCEDURE statement is used to drop a stored procedure.
Syntax
DROP PROCEDURE [IF EXISTS] sp_name
Parameters
Parameter |
Note |
|---|---|
| IF EXISTS | Optional. If the stored procedure does not exist, no error is returned; only an alert is generated. |
| sp_name | The name of the stored procedure to be dropped. You can use database_name.sp_name Specify the database. |
To drop a stored routine, the user must have the ALTER ROUTINE privilege.
If the stored program does not exist, using the IF EXISTS clause prevents errors and generates an alert that you can view using SHOW WARNINGS.
Examples
Deletes a stored procedure.
obclient> DROP PROCEDURE IF EXISTS proc_name;
Drop a stored procedure in a specified database:
obclient> DROP PROCEDURE IF EXISTS test_db.get_employee_list;