MySql: create procedure error <p>I'm trying to create a stored procedure, either in command line or MySql Workbench editor.</p> <p>In Mysql WOrkbench I have no message at all, no success no error, but the procedure is not created. In command line <code>mysql --host=localhost ... &lt; procedure-script.sql</code> I get the following error:</p> <blockquote> <p>ERROR 1064 (42000) at line 4: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 28</p> </blockquote> <p>Line 28 is actually empty but I guess it refers to the final <code>DELIMITER ;</code> in line 31. Here is the complete code:</p> <pre><code>DELIMITER $$; -- drop procedure if exists updPages$$ CREATE PROCEDURE updPages() BEGIN DECLARE _post_id INTEGER; DECLARE cur_pages CURSOR FOR select ID from wp_posts where post_type='page' and ID not in (select post_id from wp_postmeta); OPEN cur_pages; Reading_Pages: LOOP FETCH cur_pages INTO _post_id; IF done THEN LEAVE Reading_Pages; END IF; insert into wp_postmeta(post_id, meta_key, meta_value) values (_post_id, '_wp_page_template', 'default'), (_post_id, 'upside-show-page-title', '1'), (_post_id, 'upside-show-breadcrumb', '1'), (_post_id, 'upside-page-show-document-search', '0'), (_post_id, 'upside-show-page-title-middle', 'false'), (_post_id, '_vc_post_settings', 'a:1:{s:10:"vc_grid_id";a:0:{}}'); END LOOP; CLOSE cur_pages; END$$ DELIMITER ; </code></pre> <p>(1) Is there any error? (2) Do you know how to show compilation errors in Mysql Workbench? also, (3) can I use tab inside scripts when running them from command line? (I had to strip them out as I had errors)</p>