Add procedure or function to database with PhpMyAdmin

04.19.2012 | 7:10 am | Code

Script before
/* Example script */
DROP PROCEDURE IF EXISTS calculateLength $$
CREATE PROCEDURE calculateLength ()
BEGIN

SELECT value FROM `table` WHERE 1=1

END;
/* End script */

Solution

  1. Go to any SQL tab in phpMyAdmin.
  2. Directly below the SQL text area you’ll see a text input labeled “Delimiter.” In that field, enter “$$”.
  3. I can then paste in this slightly-modifed SQL script. Notice, I’ve removed the DELIMITER statements. phpMyAdmin handles that for me.

/* Example script */
DROP PROCEDURE IF EXISTS calculateLength $$
CREATE PROCEDUREĀ calculateLength ()
BEGIN

SELECT value FROM `table` WHERE 1=1

END $$
/* End script */

No Comments »

No comments yet.

 

Leave a comment