Drop table by procedure : Procedure « Procedure Function « SQL / MySQL






Drop table by procedure

       


mysql>
mysql>
mysql>
mysql> delimiter $$
mysql>
mysql> CREATE PROCEDURE DROP_TABLE(IN TABLENAME VARCHAR(64))
    -> BEGIN
    ->    SET @SQL_STATEMENT = CONCAT('DROP TABLE ', TABLENAME);
    ->    PREPARE S1 FROM @SQL_STATEMENT;
    ->    EXECUTE S1;
    ->    DEALLOCATE PREPARE S1;
    -> END$$
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> delimiter ;
mysql>

mysql>
mysql>
mysql>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Using an OUT parameter
2.Creating a Single-Statement Procedure
3.Calling a Single-Statement Procedure
4.Creating a Multistatement Stored Procedure
5.The ALTER statement lets you change the characteristics of a stored procedure
6.To remove a stored procedures, use the DROP statement
7.Calculate the power in procedure
8.Cleanup table with procedure
9.Compare value in a procedure
10.Output comparison value from a procedure
11.Find out the age with procedure
12.Syntax for Changing store procedures
13.Syntax for Creating store procedures