Search code examples
symfonydoctrine-ormoracle11gdoctrine

How to call an Oracle stored procedure with output parameters using doctrine?


I have been calling stored procs in Oracle using doctrine doing something like:

$sql = "CALL namespace.my_proc(".$data_source_id.", to_date('".$account_period_start."', 'YYYY-MM-DD'),'".$updated_by."')";

$stmt = $this->getDoctrine()->getManager('fdw')->getConnection()->prepare($sql);
            $result = $stmt->execute();
            $stmt->closeCursor();

Now the DBA team has changed one of the stored procs to accept 2 output parameters (x and y) and I am not understanding how to make that happen. Can someone please assist me with that?

Thank You


Solution

  • I was able to find out the info. Hope it helps someone.

    $sql = "CALL namespace.my_proc(".$data_source_id.", to_date('".$account_period_start."', 'YYYY-MM-DD'),'".$updated_by."', :x, :y)";
      $stmt = $this->getDoctrine()->getManager('fdw')->getConnection()->prepare($sql);
                $stmt->bindParam(':x', $x, \PDO::PARAM_INPUT_OUTPUT, 32);
                $stmt->bindParam(':y', $y, \PDO::PARAM_INPUT_OUTPUT, 32);
                $result = $stmt->execute();