Oracle BLOB column type

I’m building a content submission form using the nh-ckeditor extension for the content body area. I’m using Oracle with the pdo_oci driver, and its been working great so far.

I have a column in the database as a type BLOB - and the model is limiting the content to 4000 characters. I changed that limit to 40000 just for grins so I could test a longer post, and I get

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1461 OCIStmtExecute: ORA-01461: can bind a LONG value only for insert into a LONG column

So YII is thinking this is a LONG type, not a BLOB.

Any ideas ?



PDO OCI is interpreting your string as LONG, since it is a very large string.

I suggest you to use Yii DAO, since you cand bind your field with PDO::PARAM_LOB. Read here PDO Lobs

*PS: I am developing OCI-AR support for LOBs. I hope to publish it as soon as I can.

I have the same error while uploading PDF or JPG file into a BLOB column

"CDbCommand failed to execute the SQL statement: ORA-01461"

I have tried with this code but the result is the same… Any suggestions?

$t = 'dc_conferme';


			$file_name = $file->name;

			$file_type = $file->type;

			$file_size = $file->size;

			$file_contents = file_get_contents($file->tempName);

			// sql                  

			$sql="INSERT INTO ".$t." (file_name,file_size,file_type,ricevuta) 


			$connection = Yii::app()->db;


			// bind params






Someone managed to make sending a BLOB to Oracle?

I have worked it out.

I search it all around the net, finally I found a probably solution at Large Object.

I follow the example #2


$db = new PDO('odbc:SAMPLE', 'db2inst1', 'ibmdb2');

$stmt = $db->prepare("insert into images (id, contenttype, imagedata) values (?, ?, ?)");

$id = get_new_id(); // some function to allocate a new ID

// assume that we are running as part of a file upload form

// You can find more information in the PHP documentation

$fp = fopen($_FILES['file']['tmp_name'], 'rb');

$stmt->bindParam(1, $id);

$stmt->bindParam(2, $_FILES['file']['type']);

$stmt->bindParam(3, $fp, PDO::PARAM_LOB);





I get the db by

$db = Yii::app()->db->getPdoInstance() 

instead by

$db = new PDO('odbc:SAMPLE', 'db2inst1', 'ibmdb2');

and other things are all the same.