|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-03-12 18:27 UTC] jarismar at adplabs dot com dot br
[2008-04-01 03:28 UTC] charles at crh-systems dot com
[2009-01-09 16:41 UTC] inbox at trevorbramble dot com
[2009-04-25 14:44 UTC] jani@php.net
[2009-04-30 19:44 UTC] jarismar at gmail dot com
[2009-04-30 19:57 UTC] jarismar at adplabs dot com dot br
[2009-11-02 20:06 UTC] markus at computino dot de
[2009-11-02 20:35 UTC] pajoye@php.net
[2010-05-26 15:05 UTC] firegun at thehummels dot org
[2011-01-28 14:55 UTC] john dot doe at trash-mail dot com
[2012-08-17 20:30 UTC] zulrang at gmail dot com
[2012-10-26 05:57 UTC] sixd@php.net
-Assigned To: sixd
+Assigned To:
[2014-01-01 12:53 UTC] felipe@php.net
-Package: PDO related
+Package: PDO OCI
[2021-07-09 16:30 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2021-07-09 16:30 UTC] cmb@php.net
[2021-07-18 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 00:00:01 2025 UTC |
Description: ------------ I'm using pdo_oci and oracle 10g (10.2). Trying to insert into a CLOB column using multi-byte charset (AL32UTF8) results on the following error: ORA-01461: can bind a LONG value only for insert into a LONG column. The column datatype in not LONG it's a CLOB ! Changing the connection charset to use WE8ISO8859P1 or any other single byte charset solve the problem (the insert command ends with no error), but I loose all non ISO characters (my data gets corrupted). Reproduce code: --------------- try { $sDSN = "oci:dbname=$sConId;charset=AL32UTF8"; $oPDO = new PDO($sDSN, $sUserName, $sPassword); $oPDO->beginTransaction(); $oStmt = $oPDO->prepare("insert into test_clob (id, data) values (:id, EMPTY_CLOB())"); $iID = 1; $oStmt->bindParam(':id', $iID); if ($oStmt->execute()) { $oStmt = $oPDO->prepare("update test_clob set data=:value where id=1"); $sData = str_repeat('x', 65535); $oStmt->bindParam(':value', $sData); if ($oStmt->execute() === false) { throw new Exception('Error on update clob'); } } else { throw new Exception('Error on insert EMPTY_CLOB'); } $oStmt = $oPDO->prepare("select data from test_clob where id = :id"); $oStmt->bindParam('id', $iID); $oStmt->execute(); $oResult = $oStmt->fetch(); echo 'Read '.strlen(stream_get_contents($oResult['DATA'])).' characters <br>'; $oPDO->commit(); } catch (Exception $oE) { if ($oStmt) { echo '<pre>';print_r($oStmt->errorInfo());echo "</pre><br>\n"; } echo $oE->getMessage()."<br>\n"; } $oPDO = null; Expected result: ---------------- Read 65535 characters Actual result: -------------- Array ( [0] => HY000 [1] => 1461 [2] => OCIStmtExecute: ORA-01461: can bind a LONG value only for insert into a LONG column (ext\pdo_oci\oci_statement.c:142) ) Error on update clob