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.