title: How to create a stored procedure containing a DELIMITER in PHP with PDO?
body: <p>In my model I defined some procedures. The code (generated by MySQL Workbench) contains <code>DELIMITER</code> definitions, so the procedures look like:</p>
  
  <pre><code>-- schema
  CREATE DATABASE ...
  CREATE TABLE foo ...
  -- procedures
  DELIMITER $$
  ...
    BEGIN
      DECLARE ... ;
      OPEN ... ;
      SET ... ;
      ... ;
    END$$
  DELIMITER ;
  </code></pre>
  
  <p>Now I need to "import" the SQL to the database via <a href="http://php.net/manual/en/book.pdo.php" rel="nofollow noreferrer">PDO</a>. I tried to pass it as input for the <a href="http://php.net/manual/en/pdo.exec.php" rel="nofollow noreferrer"><code>PDO#exec(...)</code></a>, but noticed, that the execution stops on the line of the first <code>DELIMITER</code> definition.</p>
  
  <p>I don't want remove the <code>DELIMITER</code> statements. So the the SQL code should remain the same.</p>
  
  <p><strong>How to use PDO to execute SQL code containing <code>DELIMITER</code> statements?</strong></p>