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!

Unable to insert a blob from php...

584288Aug 9 2007 — edited Aug 10 2007
I followed the example of the Undergroun Oracle + PHP Manual and wrote this:
	/* Connect to the database */
	include("connect.php");

	$file_content1 = "My test";
	$query = "INSERT INTO TRAIN_REG (ID_TRAIN_REG, WNN_MEMORY) VALUES (1, EMPTY_BLOB()) RETURNING WNN_MEMORY INTO :WNN_MEM_LOB";
	$parsed = oci_parse($db_conn, $query);
	$wnn_mem_LOB = oci_new_descriptor($db_conn, OCI_D_LOB);
	oci_bind_by_name($parsed, ":WNN_MEM_LOB", $wnn_mem_LOB, -1, OCI_B_BLOB));
	oci_execute($parsed, OCI_DEFAULT);

	/* Now save a value to the LOB */
	if (!$wnn_mem_LOB->save($file_content1)) 
	{
		echo "Problem";
		/* On error, rollback the transaction */
		oci_rollback($db_conn);
	}
	else 
	{
		echo "Nice!";
		 /* On success, commit the transaction */
		oci_commit($db_conn);
	}
I always get "Problem"...

Also, in the underground manual it says to use OCI_B_LOB instead of OCI_D_LOB in the oci_new_descriptor call, but I could not get it to work that way, and browsing in php.net it says to use D instead of B.

Any advice?

Thanks in advance,

Fernando LĂ­bio.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2007
Added on Aug 9 2007
9 comments
6,779 views