Posts

Showing posts from January, 2016

Remove MySQL SPs

Sub Procedures are MySQL way of giving decision implementation capability, that is beyond SQL queries.

Sub procedures are created and removed using CREATE PROCEDURE and DROP PROCEDURE. If you need to delete a SP (Sub Procedure), you can use following

DROP PROCEDURE IF EXISTS sp_name

However, at times, you may need to remove all the SPs, i.e. remove all sub procedures from the DB, or MySQL installation.

This may be required, if, for instance, you imported multiple SPs without using a database (i.e. use ). Instead of dropping them tediously one by one, you can remove them by using following


Remove all SPs from MySQL installation
mysql> DELETE FROM mysql.proc ;

Remove all SPs from a given Database
mysql> DELETE FROM mysql.proc WHERE database= '' AND type = 'PROCEDURE' ;