title: Error -104 Unexpected end of command creating a Firebird stored procedure
body: <p>I want to create a stored procedure in Firebird:</p>
  <pre><code> CREATE PROCEDURE CalcPvIncome
   ( BeginDate date,
     EndDate   date,
     KwPrice   decimal (2,2) ) 
     
  RETURNS ( Total_PV_Production decimal (9,2),
            Total_Income decimal (9,2) )
  AS
  BEGIN
    
     FOR SELECT SUM(ENERGY/1000), SUM((ENERGY/1000) * :KwPrice) 
         FROM PVPROD 
         WHERE proddate &gt;= :BeginDate AND proddate &lt;= :Enddate 
         INTO :Total_PV_Production , :Total_Income
         DO
         
         BEGIN
          SUSPEND ;
         END
  END
  </code></pre>
  <p>I get this error:</p>
  <blockquote>
  <p>Engine Code : 335544569</p>
  <p>Engine Message : Dynamic SQL Error SQL error code = -104 Unexpected end of command - line 18, column 9</p>
  </blockquote>
  <p>The SQL statement:</p>
  <pre><code>SELECT 
     SUM(ENERGY/1000) AS Total_PV_Production, 
     sum((ENERGY/1000)*0.55) as Total_Income
  FROM 
     PVPROD 
  where  
     proddate &gt;= '12.06.2012' and  proddate &lt;= '12.07.2012'
  </code></pre>