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' ;

Comments

Popular posts from this blog

504 Gateway Timeout on Amazon AWS ELB (Elastic Load Balancer)

AWS RDS incompatible-parameters solved

Sone ke gahno ki Bangalore mein adla badli (exchange)