title: Call Oracle Stored Procedure from PHP with input and output Parameters
body: <p>Im trying to implement an easy Stored Procedure into PHP.
  Im using Oracle SQL and I have to use PDO for connection to the database.</p>
  
  <p>The Procedure looks like this:</p>
  
  <pre><code>create or replace 
  PROCEDURE RABATTPROZEDUR 
  (
    VAR_KUNDE IN NUMBER  
  , VAR_RABATT IN NUMBER  
  , VAR_DATUM IN DATE  
  , ERGEBNIS OUT NUMBER  
  ) AS 
  var_volumenBegin NUMBER := 0;
  var_volumenEnd NUMBER := 0;
  
  BEGIN
  
  
  Select SUM(TOTALPRICE) into var_volumenBegin From Orderposition Where Ordid IN (Select Ordid From Orders Where Custid = var_kunde);
  
  Update Orderposition Set TOTALPRICE = (TOTALPRICE * (100 - var_rabatt) / 100) Where Ordid IN(Select Ordid From Orders Where Custid = var_kunde And Orderdate &gt;= var_datum);
  
  Select SUM(TOTALPRICE) into var_volumenEnd From Orderposition Where Ordid IN (Select Ordid From Orders Where Custid = var_kunde); 
  
  ergebnis := var_volumenBegin-var_volumenEnd;
  
  END RABATTPROZEDUR;
  </code></pre>
  
  <p>In PHP, it looks like this:</p>
  
  <pre><code>$ergebnis = 0;
                      $a= ':cid';
                      $b= ':percent';
  
                      $stmt = $conn-&gt;prepare("CALL rabattprozedur(:var_kunde,:var_rabatt,to_date(':var_datum'),:ergebnis)");
                      $stmt-&gt;bindParam(':var_kunde',$a,PDO::PARAM_INT);
                      $stmt-&gt;bindParam(':var_rabatt',$b,PDO::PARAM_INT);
                      $stmt-&gt;bindParam(':var_datum',$date,PDO::PARAM_STR,10);
                      $stmt-&gt;bindParam(':ergebnis',$ergebnis,PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT);
  
                      //$stmt-&gt;bindParam($a = ':cid',$b = ':percent',$date,$ergebnis); 
                      $stmt-&gt;debugDumpParams();
                      $stmt-&gt;execute();    
  </code></pre>
  
  <p>Unfortunately that doesnt work. The error message im getting is: </p>
  
  <pre><code>SQLSTATE[HY000]: General error: 1722 OCIStmtExecute: ORA-01722: invalid number (ext\pdo_oci\oci_statement.c:148)
  </code></pre>
  
  <p>I tried different methods and approaches but cant get it to work.
  Thanks for any help!</p>