Hello,
i would really appreciate if someone could help me here. It'a about calling oracle stored procedure with some input and output parameters.
I have this working using ADODB class, but now I need the same thing using PDO Extension. It's all ok when output parameter is some value accept cursor.
This is code working with ADODB:
$conn_thor = newADOconnection("oci8");
$conn_thor->connect(connection parameters);
$stmt = $conn_thor->PrepareSP("BEGIN PKG_THOR.GET_USER_ROLES_AUTH (:ulaz1, :ulaz2, :ulaz3, :crsr, :izlaz); END;");
$conn_thor->InParameter($stmt, $login, 'ulaz1');
$conn_thor->InParameter($stmt, $GLOBALS["apl_sifra"], 'ulaz2');
$conn_thor->InParameter($stmt, $_SERVER['REMOTE_ADDR'], 'ulaz3');
$conn_thor->OutParameter($stmt, $cur, 'crsr', -1, OCI_B_CURSOR);
$conn_thor->OutParameter($stmt, $izlaz, 'izlaz');
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$array_user_role = $conn_thor->GetArray($stmt);
With this I have two outputs. $izlaz is integer, and $array_user_role i array of roles for user.
Now I need to do this using PDO.
try {
$conn_sso = new PDO(connection parameters);
$ulaz1 = 'admin';
$ulaz2 = 'A901';
$ulaz3 = $_SERVER['REMOTE_ADDR'];
$stmt = $conn_sso->prepare("CALL PKG_THOR.GET_USER_ROLES_AUTH (:ulaz1, :ulaz2, :ulaz3, :crsr, :izlaz)");
$stmt->bindParam(':ulaz1', $ulaz1, PDO:😛ARAM_STR);
$stmt->bindParam(':ulaz2', $ulaz2, PDO:😛ARAM_STR);
$stmt->bindParam(':ulaz3', $ulaz3, PDO:😛ARAM_STR);
$stmt->bindParam(':crsr', $crsr, ????here is the problem????);
$stmt->bindParam(':izlaz', $izlaz, PDO:😛ARAM_INT|PDO:😛ARAM_INPUT_OUTPUT , 4);
$stmt->execute();
echo "izlaz: " . $izlaz;
$conn_sso = null;
}
catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
Thank You....