Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Cannot insert CLOB into table with PDO_OCI

519172Jun 20 2006
I'm trying to insert data into a CLOB field with PDO, but I always get
an error (working with a BLOB instead of a CLOB works, though):

OCIStmtExecute: ORA-00932: Inkonsistente Datentypen: BLOB erwartet, CLOB
erhalten (ext\pdo_oci\oci_statement.c:142)
That would be in english:
OCIStmtExecute: ORA-00932: inconsistent datatypes: expected BLOB got
CLOB (ext\pdo_oci\oci_statement.c:142)

I'm using PHP 5.1.4 and a full Oracle 10g client under Windows XP.

Does anyone know what I'm doing wrong?

Thanks in advance for your help!


Reproduce code:
---------------
php:

/* TABLE STRUCTURE:
================
TEXT CLOB
DIGIT NUMBER(10) */

try { $db = new PDO('oci:dbname=oracle_test;charset=UTF-8', 'scott',
'tiger'); }
catch (PDOException $e) { echo 'Failed to obtain database handle ' .
$e->getMessage(); exit; }
$stmt = $db->prepare("insert into UTF8TEST (text, digit) " .
"VALUES ( null, ?) ".
"RETURNING text INTO ?");
$fp = fopen('utf8text.txt', 'rb');
$digit = '12345';
$stmt->bindParam(1, $digit);
$stmt->bindParam(2, $fp, PDO::PARAM_LOB);

$db->beginTransaction();
if ( $stmt->execute() ) { echo "Successfully inserted UTF-8 into
table\n"; } else { print_r($stmt->errorInfo()); }
$db->commit();

Comments

Processing
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jul 18 2006
Added on Jun 20 2006
0 comments
1,207 views