469,336 Members | 6,193 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Problem with Oracle selecting object types

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?

Jul 19 '06 #1
3 2985
On Wed, 19 Jul 2006 16:29:38 -0700, sam.lumbroso 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?
Sam, I haven't ever done named types, but I would try using OCI8 instead
of using OCI and I would try oci_define_by_name with OCI_NTY bind type.
I'm not sure that OCI supports object type bindings and I am sure that OCI
is deprecated.

--
http://www.mgogala.com

Jul 20 '06 #2
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
Jul 20 '06 #3
Thank you for the response, Mladen. Fortunately, it is not crucial, I
was just looking to simplify my work.

Jul 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

42 posts views Thread by Paul | last post: by
1 post views Thread by Chad | last post: by
3 posts views Thread by Tony Marston | last post: by
19 posts views Thread by Gregor =?UTF-8?B?S292YcSN?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.