带有PDO的php中的Oracle程序 [英] Procedures of Oracle in php with PDO

查看:42
本文介绍了带有PDO的php中的Oracle程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在propel 1.6和oracle过程中遇到问题.我将其发布在PDO下,因为我是Propel,仅是为了将呼叫代理到PDO.

I'm having a problem with propel 1.6 and a oracle procedure. I post it under PDO because I'm Propel just for proxying my call to PDO.

基本上程序得到用户名和密码,检查是否 单击确定并返回用户. 因此,它返回一个types.cursorType.

Basically the procedure get the user name and password, checks that is OK and return the user. For that reason it returns an types.cursorType.

sql像这样启动.

The sql start like this.

CREATE OR REPLACE 
PROCEDURE         "SP_LOGIN" (R_CURSOR OUT types.cursorType, UserId IN 
VARCHAR2, Password IN VARCHAR2) 

我的php代码是:

$con = Propel::getConnection(); 
$sql = 'BEGIN SP_LOGIN(:CURSOR, :0, :1); END;'; 
$stmt = $con->prepare($sql); 
$result_arr; 
$stmt->bindParam(":CURSOR", $result_arr, PDO::PARAM_STR || PDO::PARAM_INPUT_OUTPUT); 
$stmt->bindParam(":0", $username, PDO::PARAM_STR); 
$stmt->bindParam(":1", $password, PDO::PARAM_STR); 
$stmt->execute(); 
$result_arr = $stmt->fetchAll(); 

现在抛出一个类型异常: {PDOException} SQLSTATE [HY000]:一般错误:6550 OCIStmtExecute: ORA-06550:第1列,第7栏: PLS-00306:调用"SP_LOGIN"的错误参数的数量或类型

Now that throws an exception of type: {PDOException} SQLSTATE[HY000]: General error: 6550 OCIStmtExecute: ORA-06550: línea 1, columna 7: PLS-00306: numbers or types of bad arguments calling 'SP_LOGIN'

我做错了什么?

谢谢.

P.S:我在Propel论坛上问了这个问题,他们指示我搜索PDO解决方案.

P.S: I ask this question on the Propel forum and they direct me to search for the PDO solution.

推荐答案

我怀疑问题是第一个参数.您告诉PDO它是一个字符串(PDO::PARAM_STR),但实际上是types.cursorType. PHP手册中有用户注释,该建议表明引用游标不受支持.

I'd suspect the problem is the first parameter. You tell PDO that it's a string (PDO::PARAM_STR) but it's actually types.cursorType. There's a user comment in the PHP manual that suggests that ref cursors are not supported.

不幸的是,用于PDO的Oracle驱动程序是试验性的,并且(IMHO)基本上已被放弃.

Unluckily, the Oracle driver for PDO is experimental and (IMHO) basically abandoned.

这篇关于带有PDO的php中的Oracle程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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