title: Magento: Create Stored Procedure
body: <p>I am trying to create a Magento module installer, that will in turn create a stored procedure.</p>
  
  <p>The code for the procedure has been run through: Toad, phpmyadmin, and mysql.exe command line. It worked in all 3. However, it fails when Magento goes to execute it during the installation process.</p>
  
  <p>Error: </p>
  
  <pre><code>SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;
  </code></pre>
  
  <p>Magento Code:</p>
  
  <pre><code>    $installer = $this;
      $installer-&gt;startSetup();
      $sql = &lt;&lt;&lt;____SQL
         DELIMITER // 
  
         CREATE PROCEDURE GetStuff(
             IN pSomeId int(11)
         )
         BEGIN
           DECLARE pOtherId INT;
  
         SELECT some_var INTO pOtherId FROM some_table WHERE id = pSomeId;
         END;//
         DELIMITER ;
         ____SQL;
  
       $installer-&gt;run($sql);
       $installer-&gt;endSetup();
  </code></pre>
  
  <p>There's some other code in between, of course, but simplifying did not change the error.
  My guess is that it is something to do with Delimeters and how PDO/Magento is treating them. Thank you.</p>