|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-12-19 19:42 UTC] blair dot chesnut at gmail dot com
Description:
------------
Using PDO/OCI via Yii framework. Inserts/updates to varchar2(4000) column fail with error ORA-01461 when value exceeds 1332 characters.
Line 300 of source php-5.4.9/ext/pdo_oci/oci_statement.c:
value_sz = 1332; /* maximum size before value is interpreted as a LONG value */
Why???
I changed to "value_sz = 4000", recompiled, and inserts/updates work fine. I'm not using CLOBs, only varchar2() columns.
Test script:
---------------
$dbh = new PDO($dsn, $dbuser, $dbpass);
$sth = $dbh->prepare('insert into some_table (some_varchar4000_column) values (:p1)');
$big_value = str_repeat('ABCDEFGHIJ', 300);
$sth->bindValue(':p1', $big_value, PDO::PARAM_STR);
$sth->execute();
print_r($sth->errorInfo());
Expected result:
----------------
Array
(
[0] => 00000
[1] =>
[2] =>
)
Actual result:
--------------
Array
(
[0] => HY000
[1] => 1461
[2] => OCIStmtExecute: ORA-01461: can bind a LONG value only for insert into a LONG column
(/usr/local/src/php-5.4.5/ext/pdo_oci/oci_statement.c:146)
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
You can get around this by adding the size to the bind statement: $sth->bindValue(':p1', $big_value, PDO::PARAM_STR, 4000);