Bug #50906 [Com]: ORA-03131: an invalid buffer was provided for the next piece(Same as Bug#39820)
Edit report at https://bugs.php.net/bug.php?id=50906&edit=1
ID: 50906
Comment by: sheyda dot babi5161 at gmail dot com
Reported by: symphony dot group at yahoo dot com
Summary: ORA-03131: an invalid buffer was provided for the
next piece(Same as Bug#39820)
Status: Open
Type: Bug
Package: PDO OCI
Operating System: Irrelevant
PHP Version: 5.2.12
Block user comment: N
Private report: N
New Comment:
I faced similar kind of issue last time, I am still searching for some proper solution.
(https://www.hca-rewards.net/)github.com
Previous Comments:
------------------------------------------------------------------------
[2010-02-02 10:11:55] symphony dot group at yahoo dot com
Description:
------------
When binding out variables, you have to specify the data type and length manually with PDO_OCI.
If not you receive an oracle error:
ORA-03131: an invalid buffer was provided for the next piece
This bug exists in both PHP 5.2.12 and 5.3.1
Reproduce code:
---------------
the following simple code easily re-produces the bug:
try {
$dbConn = new PDO('oci:dbname=.....);
$dbConn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$sql = $dbConn->prepare("
BEGIN
SELECT username
INTO :chkId
FROM USERS
WHERE username = 'fred';
END;
");
$sql->bindParam('chkId', $chkId);
$sql->execute();
var_dump($chkId);
} catch (Exception $e) {
var_dump($e);
}
obviously I've censored our connection info.
as the other user mentioned in bug #39820 if I alter the bindParam to:
$sql->bindParam('chkId', $chkId, PDO::PARAM_STR, 10);
it works. however even missing off the variable length causes a error
Expected result:
----------------
string ('fred');
Actual result:
--------------
object(PDOException)#3 (8) {
["message":protected]=>
string(173) "SQLSTATE[HY000]: General error: 3131 OCIStmtExecute: ORA-03131: an invalid
buffer was provided for the next piece
(....../php-5.3.1/ext/pdo_oci/oci_statement.c:146)"
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
string(5) "HY000"
["file":protected]=>
string(20) "/root/pdoOciTest.php"
["line":protected]=>
int(14)
["trace":"Exception":private]=>
array(1) {
[0]=>
array(6) {
["file"]=>
string(20) "/root/pdoOciTest.php"
["line"]=>
int(14)
["function"]=>
string(7) "execute"
["class"]=>
string(12) "PDOStatement"
["type"]=>
string(2) "->"
["args"]=>
array(0) {
}
}
}
["previous":"Exception":private]=>
NULL
["errorInfo"]=>
array(3) {
[0]=>
string(5) "HY000"
[1]=>
int(3131)
[2]=>
string(136) "OCIStmtExecute: ORA-03131: an invalid buffer was provided for the next piece
(...../php-5.3.1/ext/pdo_oci/oci_statement.c:146)"
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=50906&edit=1
Thread (3 messages)