yajra / pdo-via-oci8

PHP PDO_OCI functions via OCI8 extension
Other
88 stars 61 forks source link

Fix SQLT_NTY collection binding. #74

Closed barrigapicante closed 4 years ago

barrigapicante commented 4 years ago

Fix https://github.com/yajra/pdo-via-oci8/issues/73.

barrigapicante commented 4 years ago

Hello man, update ready, I tested checking the datatype with an output parameter and it work correctly:

code BD

CREATE OR REPLACE PROCEDURE PRUEBA_FUNC_CURSOR_1(P_CUR OUT ARRAY_DATOS2) IS v_num number; BEGIN P_CUR := ARRAY_DATOS2(); FOR R_D IN (SELECT CONTENIDO AS DATOS FROM ARAUCANO) LOOP P_CUR.EXTEND; P_CUR(P_CUR.LAST) := R_D.DATOS; END LOOP; END;

cod PHP

$prueba = null; //$prueba = oci_new_collection($conn,'ARRAY_DATOS2','SIUC'); $options = array("type_name" => "ARRAY_DATOS2","schema" => "SIUC"); $pdo = DB::getPdo(); $stmt_rec = $pdo->prepare("begin SIUC.PRUEBA_FUNC_CURSOR_1(:p2); end;"); $stmt_rec->bindParam(':p2', $prueba, SQLT_NTY, -1, $options); $result = $stmt_rec->execute();

foreach ($prueba as $key => $value) { echo($prueba->getElem(intval($key)));
} dd("");