title: Mysql error: Error Code: 1292. Truncated incorrect DOUBLE value
body: <p>I'm getting this error while executing this stored procedure in MySQL:</p>
  <p><code>Error Code: 1292. Truncated incorrect DOUBLE value: 'WHERE s.name = 'Confirmed'   AND bp.id = ''</code></p>
  <pre><code>DROP PROCEDURE IF EXISTS test;
  DELIMITER //
  CREATE PROCEDURE test (province VARCHAR(100), country VARCHAR(100), departureDate TIMESTAMP, arrivalDate TIMESTAMP, people INTEGER) 
  BEGIN 
   DECLARE selectClause VARCHAR(500) DEFAULT &quot;SELECT DISTINCT b.id, b.boat_model_id, b.port_id, b.address_id, b.maximum_discount, 
                   b.discounts_have_subtotals, b.skipper_type_id, b.length, b.people_capacity_id,
                   b.simple_cabin_id, b.double_cabin_id, b.bathroom_id, year_id &quot;;         
   DECLARE fromClause VARCHAR(500) DEFAULT &quot;FROM states s, boat_people bp, boat_prices bprd, boat_prices bpra, boats b &quot;;
   DECLARE whereClause VARCHAR(1000) DEFAULT &quot;WHERE s.name = 'Confirmed' 
   AND bp.id = &quot; + people + &quot;
   AND b.state_id = s.id 
   AND b.id NOT IN (SELECT bc.boat_id 
                    FROM boat_calendars bc 
                    WHERE (date(bc.since) &lt;= &quot; + departureDate + &quot; AND date(bc.until) &gt;= &quot; + departureDate + &quot;)   
                    OR (date(bc.since) &lt;= &quot; + arrivalDate + &quot; AND date(bc.until) &gt;= &quot; + arrivalDate + &quot;))
   AND bprd.boat_id = b.id 
   AND date(bprd.since) &lt;= &quot; + departureDate + &quot; AND date(bprd.until) &gt;= &quot; + departureDate + &quot;
   AND bpra.boat_id = b.id 
   AND date(bpra.since) &lt;= &quot; + arrivalDate + &quot; AND date(bpra.until) &gt;= &quot; + arrivalDate + &quot;
   AND truncate(((bprd.weekly_price + bpra.weekly_price)/2), 2)  &gt; 0&quot;;
   SET @queryClause = concat(selectClause, fromClause, whereClause);
   PREPARE stmt FROM @queryClause;
   EXECUTE stmt;
   DEALLOCATE PREPARE stmt;
  END // 
  CALL test('Mallorca (Islas Baleares)', 'España', '2016-03-02 16:02:12', '2016-03-02 16:02:12', 1);
  </code></pre>
  <p>Table <code>boat_people.id</code> is <code>INT(11)</code>.</p>