如何使用oci驱动程序从oracle中具有过程的php调用程序包? [英] How to call package from php having procedure in oracle using oci drivers?

查看:160
本文介绍了如何使用oci驱动程序从oracle中具有过程的php调用程序包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用具有使用oci驱动程序的过程的oracle软件包. 我收到

I am calling oracle package having procedure using oci drivers. I am getting error as

警告:oci_execute()[function.oci-execute]:ORA-06550:第1行,第7列:PLS-00306:对"GET_BRAND_MODEL_LIST"的调用中参数的数量或类型错误ORA-06550:第1行,第7:PL/SQL:在第26行的/opt/lampp/htdocs/call.php中忽略了该语句

Warning: oci_execute() [function.oci-execute]: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GET_BRAND_MODEL_LIST' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in /opt/lampp/htdocs/call.php on line 26

所有参数正确. $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..

推荐答案

据我所记得,您必须为

As far as I remember you have to specify type and maxlength to oci_bind_by_name() for variables returned from the procedure.

假设:rOUT变量,请尝试:

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调用程序包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆