views:

22

answers:

1

I'm calling an Oracle Stored procedure which takes an array as an input parameter. Owa.vc_arr(varchar2)

I'm making a call in php and getting an error. Any help would be greatly appreciated. Code which i'm using is given below.

function findSupplier($ptype) {

$proCall = 'BEGIN ICPISSAAPILIB.FIND_SUPPLIER(:P_PRODUCT_TY, :P_RESULTS); End;';

//Step 1: Prepare
$query = oci_parse($this->connect(), $proCall);                

// Bind the input P_PRODUCT_TY argument to the $prodType PHP variable
$ptype = oci_new_collection($this->connect(),'vc_arr');    
oci_bind_by_name($query,":P_PRODUCT_TY",$ptype,-1);

// Create a new cursor resource
$supplier_res = oci_new_cursor($this->connect());                      

// Bind the cursor resource to the Oracle argument
oci_bind_by_name($query,":P_RESULTS",$supplier_res,-1,OCI_B_CURSOR);

//Now Execute statement    
oci_execute($query);                   

// cursor
oci_execute($supplier_res);

//Here boy, fetch
while ($items = oci_fetch_assoc($supplier_res)) {
    $results[] = $items;
}

//returns multidimentional array containing cust_id, company_nm, street1, 
// street2, street 3, p_origin_longitude, p_radius, p_name
return $results;

}
A: 

"takes an array as an input parameter"

The question comes to mind, are you trying to pass in a string from PHP ?

If so are you intending that string to be treated as a single entry in the array, or do you need to parse it somehow any turning it into a set of strings to be assigned to the array.

Gary