You are here: Passing 2D arrays from PHP to Oracle « PHP Programming Language « IT news, forums, messages
Passing 2D arrays from PHP to Oracle

Posted by andymconline on 11/09/07 09:36

Hello all,

I have an existing Oracle database application that requires a
"simple" front-end (do these things ever turn out to be simple?).
There is an existing API written which I would like to reuse if
possible. Here is a snippet of the API:

TYPE property IS RECORD
( property_key VARCHAR2(8)
, property_value VARCHAR2(128) );

TYPE property_array IS TABLE OF property
INDEX BY BINARY INTEGER;

PROCEDURE create_customer( i_customer_id IN customer.customer_id%TYPE
, i_properties IN property_array )
IS
BEGIN
...
END create_customer;

In PHP I would like to call the create_customer procedure so would
need something like:

<?php
....
// Set-up some dummy values
$cust_id = 1
$properties = array( 'FNAME' => 'John'
, 'LNAME' => 'Smith'
, 'DOB' => '01-JAN-2007' );

$conn = oci_connect("dev", "dev", "//localhost/XE");

$stmt = oci_parse($conn, 'begin
create_customer(:cust_id, :properties); end;');

oci_bind_by_name($stmt, ':cust_id', $cust_id, -1, OCI_B_NTY);
oci_bind_array_by_name($stmt, ":properties", $properties,
count($properties), -1, SQLT_CHR);
oci_execute($stmt);

This doesn't seem to work - I've RTFM but can't seem to find any doco
on this (I've seem simple 1-dimensional array examples but nothing on
2D arrays). Is this even possible?

Any help would be gratefully appreciated!

Cheers

Andy

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация