sa**********@gmail.com wrote:
I have the following object type created in Oracle (OCI8):
create or replace type address as object
(
address VARCHAR2(80),
city VARCHAR2(80),
state VARCHAR2(20),
zip VARCHAR2(10)
)
and I have the following table created:
create table test
(
address ADDRESS
)
and when I run this:
$sql = "SELECT * FROM test";
$s = ociparse(O_CON, $sql);
ociexecute($s);
I get this error:
Warning: ociexecute(): OCIDefineByPos: ORA-00932: inconsistent
datatypes in /home/httpd/html/stats/test.php on line (the ociexecute
line)
Can I not select custom types from Oracle or is there something else I
have to do?
It will not work. It works only for VARRAY types. Here is what happens:
<?php
$tns = "TESTDB01";
$u = "mgdba";
$p = "qwerty";
$dbh = oci_connect($u, $p, $tns);
if (!$addr = oci_new_collection($dbh, 'ADDRESS')) {
die("Cannot allocate ADT descriptor for this type\n");
}
$query = "select address into :addr from test";
$sth = oci_parse($dbh, $query);
oci_bind_by_name($sth, ":addr", $addr, -1, SQLT_NTY);
oci_execute($sth);
while (oci_fetch($sth)) {
var_dump($addr);
}
?>
bash-3.1$ php object.php
Warning: oci_new_collection(): ORA-22318: input type is not an array
type in c:\tmp\object.php on line 6
Cannot allocate ADT descriptor for this type
bash-3.1$
>oerr ora 22318
22318, 00000, "input type is not an array type"
// *Cause: The user is trying to obtain the number of elements for a
// non-array type.
// *Action: Pass in only a named collection type which is an array.
This is PHP 5.1.4 on Apache 2.0.54. It will, probably, be supported in
later releases.
--
Mladen Gogala
http://www.mgogala.com