|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63809 ORA-01461 when inserting/updating more that 1333 characters
Submitted: 2012-12-19 19:42 UTC Modified: 2021-07-26 18:00 UTC
Avg. Score:4.3 ± 0.9
Reproduced:6 of 7 (85.7%)
Same Version:2 (33.3%)
Same OS:2 (33.3%)
From: blair dot chesnut at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: PDO OCI
PHP Version: 5.4.9 OS: Unix/Solaris 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: blair dot chesnut at gmail dot com
New email:
PHP Version: OS:


 [2012-12-19 19:42 UTC] blair dot chesnut at gmail dot com
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 */


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);

Expected result:
    [0] => 00000
    [1] => 
    [2] => 

Actual result:
    [0] => HY000
    [1] => 1461
    [2] => OCIStmtExecute: ORA-01461: can bind a LONG value only for insert into a LONG column


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-23 18:23 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: sixd
 [2012-12-23 23:16 UTC]
-Status: Assigned +Status: Open -Assigned To: sixd +Assigned To:
 [2012-12-23 23:16 UTC]
See also

value_sz is set to allow for character set conversion due to different client and 
server character sets.  This might increase the storage requirements when the 
data is stored in the server. The hardcoded choice of the ratio is questionable.
 [2013-08-07 15:40 UTC] zulrang at gmail dot com
You can get around this by adding the size to the bind statement:

$sth->bindValue(':p1', $big_value, PDO::PARAM_STR, 4000);
 [2014-01-01 12:35 UTC]
-Package: PDO related +Package: PDO OCI
 [2014-03-27 09:38 UTC] gureedo at gmail dot com
This is duplicate. See same bug reported earlier:
 [2021-04-29 07:27 UTC] akilas at omobio dot net

I'm getting the below error... doing an update with PDO using php 7.4.16

General error: 1461 OCIStmtExecute: ORA-01461: can bind a LONG value only for insert into a LONG column

with pdo version php-pdo-7.4.16 any solution for this???
 [2021-07-26 18:00 UTC]
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2021-07-26 18:00 UTC]
Indeed, duplicate of bug #55138.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Oct 05 19:05:52 2022 UTC