Trying to print the ocierror message but nothing comes

Greetings,
I'm trying to implement a VARRAY sample as describe here:
http://www.oracle.com/technology/pub/articles/oracle_php_cookbook/seliverstov_multirows.html
My xmlrpc php function is this:
===========
function save_word_code_vector ($params)
     include("connect.php");
     $table_name_val = $params->getParam(0);
     $table_name = $table_name_val->scalarval();
     $table_column_name_val = $params->getParam(1);
     $table_column_name = $table_column_name_val->scalarval();
     $table_line_val = $params->getParam(2);
     $table_line = $table_line_val->scalarval();
     $vector_size_val = $params->getParam(3);
     $vector_size = $vector_size_val->scalarval();
     $word_code_vector_val = $params->getParam(4);
     $collection = oci_new_collection($db_conn, "V_ARR_WORD_CODE_VECTOR");
     for ($i = 0; $i < $vectorsize; $i++)
          $collection->append($word_code_vector_val->arraymem($i)->scalarval());
     $query = "BEGIN SAVE_WORD_CODE_VECTOR(:table_name, :table_column_name, :table_line, :word_code_vector); END;";
     $parsed = oci_parse($db_conn,$query);
     oci_bind_by_name($parsed,':table_name', $table_name);
     oci_bind_by_name($parsed,':table_column_name', $table_column_name);
     oci_bind_by_name($parsed,':table_line', $table_line);
     oci_bind_by_name($parsed,':word_code_vector', $collection, -1, OCI8_B_NTY);
     $error = ociexecute($parsed);
     if (!$error)
          $e = ocierror();
          $handle = fopen("/var/www/html/db_server/save_word_code_vector.log", "a+");
          fprintf ($handle, "Function:: save_word_code_vector\n");
          fprintf ($handle, " %s\n", $query);
          fprintf ($handle, " %s\n\n", $e['message']);
          fclose($handle);
          include("disconnect.php");
          return new xmlrpcresp (new xmlrpcval(0, 'int'));
     include("disconnect.php");
     return new xmlrpcresp (new xmlrpcval(1, 'int'));
===========
It enters the if(!$error) but my output error file only contains:
===========
Function:: save_word_code_vector
BEGIN SAVE_WORD_CODE_VECTOR(:table_name, :table_column_name, :table_line, :word_code_vector); END;
===========
The message of the ocierror does not appear. Could anyone please tell me what is wrong?
Thanks in advance,
Fernando Líbio.

Read the manual again on error handling. Check typos
(e.g. $vector_size vs. $vectorsize), and use a PHP debugger or echo
statements to follow the code flow.
Perhaps use a function to handle error conditions to avoid repeating
code.
You might consider using the bulk FORALL statement in your PL/SQL procedure.
See the example in the Underground PHP and Oracle Manual.
In your example you would use:
FORALL i IN INDICES OF word_code_vector
INSERT INTO WORD_CODE_VECTOR (SEQUENCIAL, TABLE_NAME, TABLE_COLUMN_NAME, TABLE_LINE, WORD_CODE) VALUES (WORD_CODE_VECTOR_SEQ.nextval, table_name, table_column_name, table_line, word_code_vector(i));
If all you are doing with the collection is inserting individual values into a table, consider
passing a simple PHP array to PL/SQL using oci_bind_array_by_name() instead. See
the Underground manual for an example.
This PHP code works for me:
<?php
$db_conn = oci_connect('hr', 'hrpwd', '//localhost/XE');
if (!$db_conn) {
  $m = oci_error();
  echo $m['message'], "\n";
  exit;
$table_name = "some table";
$table_column_name = "some column";
$table_line = 123;
$word_code_vector_val = array(10, 20, 40, 50);
$vector_size = count($word_code_vector_val);
/* Create the collection for the VARRAY */
$collection = oci_new_collection($db_conn, "V_ARR_WORD_CODE_VECTOR");
/* Check for errors on oci_new_collection */
if (!$collection) {
     $parse_error = ocierror($db_conn);
     printf ("Function:: save_word_code_vector\n");
     printf (" New Collection:: %s\n\n", $parse_error["message"]);
     exit;
/* Append each value */
for ($i = 0; $i < $vector_size; $i++) {
     $collection->append($word_code_vector_val[$i]);
/* Build the query that will call the stored procedure for insertion */
$query = "BEGIN SAVE_WORD_CODE_VECTOR(:table_name, :table_column_name, :table_line, :word_code_vector); END;";
$parsed = oci_parse($db_conn,$query);
if (!$parsed) {
/* Check for parse errors */
     $parse_error = oci_error($db_conn);
     printf ("Function:: save_word_code_vector\n");
     printf (" %s\n", $query);
     printf (" Parsing:: %s\n\n", $parse_error["message"]);
     exit;
/* Bind the parameters */
if (!oci_bind_by_name($parsed,":table_name", $table_name)) {
     printf ("Function:: save_word_code_vector\n");
     printf (" Binding table_name:: %s\n\n", $table_name);
     exit;
if (!oci_bind_by_name($parsed,':table_column_name', $table_column_name)) {
     printf ("Function:: save_word_code_vector\n");
     printf (" Binding table_column_name:: %s\n\n", $table_column_name);
     exit;
if (!oci_bind_by_name($parsed,':table_line', $table_line)) {
     printf ("Function:: save_word_code_vector\n");
     printf (" Binding table_line:: %s\n\n", $table_line);
     exit;
if (!oci_bind_by_name($parsed,':word_code_vector', $collection, -1, OCI_B_NTY)) {
     printf ("Function:: save_word_code_vector\n");
     printf ("Binding word_code_vector::\n\n");
     exit;
$error = oci_execute($parsed);
if (!$error) {
     $e = oci_error($parsed);
     printf ("Function:: save_word_code_vector\n");
     printf (" %s\n", $query);
     printf (" %s\n\n", $e['message']);
     exit;
echo "Success\n";
?>
[pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

Maybe you are looking for

  • CD/DVD Drive Not Recognized

    I have a Dell Laptop with Vista. After installing iTunes the CD/DVD drive is no longer recognized by the computor. I have to remove the upper filter for the CD/DVD drive using 'regedit', reboot the computor and the drive is recognized again. But, iTu

  • LR may require PS Cam Raw plug-in v 8.5 for compatibility

    I get the msg "this version of Lightroom may require the Photoshop camera raw plug-in version 8.5 for full compatibility" I have updated ACR, LR and PS.  Removed older version of PS (Now at 2014 release, 20140508.r.58 x64) on macbook pro, OS X. How d

  • Using Photoshop layers in InDesign?

    Hi all, I'm having much more difficulty finding a solution than I thought I would.  Any help is greatly appreciated!  I have a designer that has put a magazine spread together in Photoshop.  It has the background, graphics, and text.  I'm looking to

  • Aperture 3 and underexposed RAW conversion

    I run Aperture 3.03 with CameraRAW 3.3 and OS 10.6.4. I use a Nikon D300 and download as referenced images into Aperture via a SanDisk card reader. Somewhere around the time I upgraded to CameraRAW 3.3 and OS 10.6.4 (not exactly at the same time but

  • Do you recommend an antivirus?

    Hello, I am downloading files using Utorrent, Do you recommend to get an antivirus for my mac or i dont need to?  if so which is the best one? Thank you very much Norman