I have a procedure in my Oracle DB with an array as output parameter. In this procedure I put all the teams with their points into an array.
create or replace package pck_tournament
as
type trranking is record (
position number
, team VARCHAR2(20)
, points number
);
type taranking is table of trranking;
procedure retrieve_ranking (oparray out taranking);
end pck_tournament;
But when I try to call this procedure with PHP I always get an error like this:
PLS-00306: wrong number or types of arguments in call to 'RETRIEVE_RANKING'
This is a part of my PHP code:
$out_arr = array();
$stmt = oci_parse($conn, "BEGIN pck_tournament.retrieve_ranking(:taranking); END;");
oci_bind_array_by_name($stmt,":taranking", $out_arr, 10000, 10000, SQLT_CHR );
oci_execute($stmt);
If I change the OUT parameter to a VARCHAR2 for testing, I'm able to read the result. But I can't manage to make it work if it is an array.
So the problem must be that I use a wrong type of argument to store my OUT parameter?
I've searched a lot of websites but still have no idea how to make this work.
CREATE TYPE trranking IS OBJECT( ... );andCREATE TYPE taranking IS TABLE OF trranking;.$stmt = oci_parse($conn, "BEGIN pck_tournament.retrieve_ranking(:taranking); END;"); $taranking = oci_new_collection($conn, 'TARANKING', '***'); oci_bind_by_name($stmt, ':taranking', $taranking, 8, OCI_B_NTY); oci_execute($stmt);Now there are no errors anymore ! How can I 'echo' all the items for each object in PHP? @ShaunPeterson