2010-02-10 22 views
0

我正在調用一個將數組作爲輸入參數的Oracle存儲過程。 Owa.vc_arr(varchar2)PHP中的Oracle SP數組參數參數

我打電話在PHP中,並得到一個錯誤。任何幫助將不勝感激。我正在使用的代碼如下。

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; 

} 
+1

小心分享錯誤? – 2010-02-10 22:00:13

回答

0

「需要一個數組作爲輸入參數」

問題想到,你想從PHP字符串傳遞?

如果是這樣,你打算將該字符串視爲數組中的單個條目,還是需要將它解析爲任何將其轉換爲要分配給數組的字符串集合。