Page 1 of 1

Unable to save CLOB column using PHP

Posted: Thu Apr 22, 2010 11:20 am
by HowardRoark
Good morning everyone,

I will admit to being new to PHP, but have been working with databases fro a very long time. I have experience with VB .NET so I am no stranger to programming in general.

That being said, I cannot get data saved into a CLOB column in a test table I have set up.

I have been working on a couple of simple master/detail pages and so far, so good. I am able save back to the table all the data, numerics, dates, small varchars, but not the CLOB.

Below is the oracle procedure that I am using for the CLOB:

create or replace PROCEDURE TEST_CLOB ( mls_sid_in IN NUMBER, notes_in IN CLOB)
AS
BEGIN
update mls_bank_test set notes = notes_in where mls_sid = mls_sid_in;
commit;
END TEST_CLOB;

And the simple PHP script I am testing it with. If you follow the printf statements, the last one I see is 2. Never get to 3.

Code: Select all

$conn = oci_connect($username, $password, $tnsName);
$stmt = oci_parse($conn, "begin test_clob(:key, :data); end;");
$clob = oci_new_descriptor($conn, OCI_D_CLOB);
$key = 169;
$data = "Hello this is a whole lot of data and I dont think this is going to work but then again who knows what the big piper has to say.";
printf("1");

oci_bind_by_name($stmt, ':key', $key);
oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB);
printf("2");
$clob->write($data);
printf("3");
oci_execute($stmt, OCI_DEFAULT);

printf("4");

oci_commit($conn);
$clob->free();
oci_free_statement($stmt);
printf("finished");
Any help would be greatly appreciated.

Thanks

HR