How to use oci_new_collection in php?

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");
    //need to do something here....
    $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);  // Execute the REF CURSOR like a normal statement id
    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?

+4
source share
2 answers

oci_new_collection, , - PHP.

, phpt , PHP. ext/oci8/tests PHP. , oci_new_collection.

, .

+2

CREATE OR REPLACE TYPE name_ntable
AS TABLE OF VARCHAR(60 CHAR)

- OCI-Collection:

$collection = oci_new_collection($connect, 'NAME_NTABLE');

, oci_bind_by_name

varray, , oci_new_collection

https://community.oracle.com/message/2436812

+1

All Articles