I am trying to call a stored procedure using php 5, my question is how to use the oci_new_collection function correctly? I did not find examples on the php site. For one of the variables that need to be passed to the stored procedure, this custom table type defined by the user is used ...
SQL> desc parameter_table
parameter_table TABLE OF PARAMETER_TYPE
Name Null? Type
---------------------- -------- ----------------------------
NAME VARCHAR2(200)
VALUE VARCHAR2(4000)
Therefore, I assume that I need to use oci_new_collection to use this type of table. My code is as follows:
$conn = DBConnect::getConnection();
$parameter_table = oci_new_collection($conn, "PARAMETER_TABLE");
$parameter_table->append(:name => "owner_id", :value => "3945073");
$curs = oci_new_cursor($conn);
$stid = oci_parse($conn, "begin reporting.execute_report(:name, :plist, :out); end;");
oci_bind_by_name($stid, ':name', "TRAFFIC_ANALYSIS_CALL_SUMMARY");
oci_bind_by_name($stid, ':plist', $parameter_table);
oci_bind_by_name($stid, ":out", $curs, -1, OCI_B_CURSOR);
oci_execute($stid);
oci_execute($curs);
while (($row = oci_fetch_array($curs, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
echo $row[0] . " " . $row[1] . "<br>\n";
}
How would I fill in the name / value fields for the $ parameter_table variable?
source
share