【问题标题】:Oracle SP array parameter in phpphp中的Oracle SP数组参数
【发布时间】:2011-01-15 11:41:02
【问题描述】:

我正在调用一个将数组作为输入参数的 Oracle 存储过程。 owa.vc_arr(varchar2)

我在 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;

}

【问题讨论】:

  • 愿意分享错误吗?

标签: php arrays oracle


【解决方案1】:

"将数组作为输入参数"

想到一个问题,你是不是想从 PHP 中传入一个字符串?

如果是这样,您是否打算将该字符串视为数组中的单个条目,或者您是否需要以某种方式对其进行解析,将其转换为一组要分配给数组的字符串。

【讨论】:

    猜你喜欢
    • 2019-12-23
    • 1970-01-01
    • 2016-05-23
    • 2017-09-02
    • 1970-01-01
    • 2018-11-24
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多