问题描述
我正在调用具有使用oci驱动程序的过程的oracle软件包.我收到
I am calling oracle package having procedure using oci drivers. I am getting error as
所有参数正确.$p_contract_no = '11-col1-cm';
$p_utilityagencyname='ATM';
$p_appliance_type='BO';
$p_tier_type=1;
$p_brand_code =NULL;
$p_execution_type='brand';
$query="begin process_101.get_brand_model_list(:p_contract_no, :p_utilityagencyname, :p_appliance_type, :p_tier_type, :p_brand_code, :p_execution_type, :r); end;";
$stid = oci_parse($conn, $query);
oci_bind_by_name($stid, ":p_contract_no", & $p_contract_no);
oci_bind_by_name($stid, ":p_utilityagencyname", & $p_utilityagencyname);
oci_bind_by_name($stid, ":p_appliance_type", & $p_appliance_type);
oci_bind_by_name($stid, ":p_tier_type", & $p_tier_type);
oci_bind_by_name($stid, ":p_brand_code", & $p_brand_code);
oci_bind_by_name($stid, ":p_execution_type", & $p_execution_type);
oci_bind_by_name($stid, ":r", $r);
oci_execute($stid);
如果有人可以解决我的问题,请提供帮助.预先感谢..
All parameters are correct.$p_contract_no = '11-col1-cm';
$p_utilityagencyname='ATM';
$p_appliance_type='BO';
$p_tier_type=1;
$p_brand_code =NULL;
$p_execution_type='brand';
$query="begin process_101.get_brand_model_list(:p_contract_no, :p_utilityagencyname, :p_appliance_type, :p_tier_type, :p_brand_code, :p_execution_type, :r); end;";
$stid = oci_parse($conn, $query);
oci_bind_by_name($stid, ":p_contract_no", & $p_contract_no);
oci_bind_by_name($stid, ":p_utilityagencyname", & $p_utilityagencyname);
oci_bind_by_name($stid, ":p_appliance_type", & $p_appliance_type);
oci_bind_by_name($stid, ":p_tier_type", & $p_tier_type);
oci_bind_by_name($stid, ":p_brand_code", & $p_brand_code);
oci_bind_by_name($stid, ":p_execution_type", & $p_execution_type);
oci_bind_by_name($stid, ":r", $r);
oci_execute($stid);
please help if anyone have solution to my problem. Thanks in advance..
推荐答案
据我所记得,您必须为 oci_bind_by_name()
表示从过程中返回的变量.
As far as I remember you have to specify type
and maxlength
to oci_bind_by_name()
for variables returned from the procedure.
假设:r
是OUT
变量,请尝试:
oci_bind_by_name($stid, ":r", $r, 50, SQLT_CHR);
以下代码可用于从Oracle过程返回值( Zend_Db_Adapter_Oracle 版本):
The following code works for returning a value from an Oracle procedure (Zend_Db_Adapter_Oracle version):
$statement = $db->prepare('BEGIN oracle_procedure(:result); END;');
$statement->bindParam('result', $result, SQLT_CHR, 12);
$statement->execute();
echo $result;
这篇关于如何使用oci驱动程序从oracle中具有过程的php调用程序包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!