title: db2_execute returns "Describe Param Failed" and "Binding Error"
body: <p>I'm running the following query using PHP's db2_prepare and db2_execute (schema names have been changed to protect the innocent):</p>
  
  <pre><code>    WITH U AS (
              SELECT *
              FROM FOO.USR
              WHERE USR_ID = ?
          ), UC AS (
              SELECT UC.*
              FROM FOO.USR_CNTRCT UC
                  JOIN U ON U.USR_ID = UC.USR_ID
          ) , LC AS (
              SELECT DISTINCT CNTRCT_ID
              FROM FOO.CNTRCT_LOC CL  
                  JOIN FOO.USR_LOC UL ON UL.SLS_CTR_CD = CL.SLS_CTR_CD
                  JOIN U ON U.USR_ID = UL.USR_ID
              WHERE CL.SLS_CTR_CD IN (?,?,?,?)
          ) 
      SELECT C.*, COALESCE(P.PGM_NM, CAST('' AS CHAR(80) CCSID 37)) AS PGM_NM,
          COALESCE(ADT.ACTN_TM, TIMESTAMP('2000001', '00.00.00')) AS TIME_ORDER
      FROM U, FOO.CNTRCT AS C
          LEFT JOIN FOO.CNTRCT_PGM CP ON CP.CNTRCT_ID = C.CNTRCT_ID
          LEFT JOIN FOO.PGM P ON P.PGM_ID = CP.PGM_ID 
          LEFT JOIN UC ON UC.CNTRCT_ID = C.CNTRCT_ID
          LEFT JOIN (
              SELECT ENTY_ID AS CNTRCT_ID, MAX(ACTN_TM) AS ACTN_TM
              FROM FOO.ADT A  JOIN U ON U.USR_ID = A.USR_ID
              WHERE ENTY_TP = 'CT'
              GROUP BY ENTY_ID
          ) AS ADT ON ADT.CNTRCT_ID = C.CNTRCT_ID
      WHERE C.APP = ? 
              AND (
                  ((SELECT COUNT(*) FROM UC) &gt; 0 AND UC.CNTRCT_ID IS NOT NULL)
                  OR
                  ((SELECT COUNT(*) FROM UC) = 0 AND UC.CNTRCT_ID IS NULL)
              ) 
              AND ? BETWEEN YEAR(STRT_DT) AND YEAR(END_DT) 
              AND (LOWER(CNTRCT_NM) LIKE ?)
      ORDER BY CNTRCT_NM ASC
  </code></pre>
  
  <p>I've confirmed that my parameters are correct in number and in order. When I execute this query, php returns two errors: <strong>Describe Param Failed</strong> and <strong>Binding Error</strong>.</p>
  
  <p>I've narrowed the problem down to this line: <code>CL.SLS_CTR_CD IN (?,?,?,?)</code>. If I use actual values here instead of parameters, the query runs fine.</p>
  
  <p>The environment is Zend Server for IBM i, PHP 5.3, DB2 (on i) V6R1. The only help I get from the job log (QEZJOBLOG) is an SQL0313 (Number of host variables not valid).</p>
  
  <p>Again, I've confirmed that I'm providing the correct number of variables. The <strong>Describe Param Failed</strong> error makes me wonder if PHP is struggling to determine the type of those four parameters. They should be type <code>string(2)</code>, and a var_dump of the parameter array passed to db2_execute confirms that they have been cast as such. </p>
  
  <p>I'm going to switch to using the values instead of parameters for that specific line, but it's going to drive me crazy until I figure out what's going on.</p>
  
  <p>Thanks</p>
  
  <p>Chad</p>