From: jarismar at adplabs dot com dot br
Operating system:
PHP version: 5.2.1
PHP Bug Type: PDO related
Bug description: Error trying to insert into CLOB column using PDO_OCI and
Streams.
Description:
------------
Trying to inset into a CLOB field usint RETURNING column INTO sql syntax,
results on the following error :
OCIStmtExecute: ORA-00932: inconsistent datatypes: expected BLOB got CLOB
I've tested with Oracle 9i and 10g (both relases 10.1 and 10.2).
Reproduce code:
---------------
try {
$oPDO = new PDO($sDSN, $sUserName, $sPassword);
$oPDO->beginTransaction();
$oStmt = $oPDO->prepare(
'INSERT INTO test_clob (id,data) '.
'VALUES (:id, EMPTY_CLOB()) '.
'RETURNING data INTO :value');
if($oStmt === false) { print_r($oPDO->errorInfo()); }
$iID = 1;
if(!$oStmt->bindParam(':id', $iID)) { print_r($oStmt->errorInfo()); }
$sData = str_repeat('x', 65535);
if(!$oStmt->bindParam(':value', $resource, PDO::PARAM_LOB)) {
print_r($oStmt->errorInfo()); }
if(!$oStmt->execute()) {print_r($oStmt->errorInfo());}
if (is_resource($resource)) {
fwrite($resource, $sData);
fclose($resource);
}
$oPDO->commit();
} catch (Exception $oE) {
print $oE->getMessage()."\n";
}
$oPDO = null;
Expected result:
----------------
No error or exception should occurs.
Actual result:
--------------
Array
(
[0] => HY000
[1] => 932
[2] => OCIStmtExecute: ORA-00932: inconsistent datatypes: expected
BLOB got CLOB
(/oracle/applications/php-5.2.0/ext/pdo_oci/oci_statement.c:142)
)
--
Edit bug report at http://bugs.php.net/?id=40785&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40785&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40785&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40785&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40785&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40785&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40785&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40785&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40785&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40785&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40785&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40785&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40785&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40785&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40785&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40785&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40785&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40785&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40785&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40785&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40785&r=mysqlcfg