|
|
|
|
|
|
| Author |
Message |
sam.lumbroso@gmail.com *nix forums beginner
Joined: 19 Jul 2006
Posts: 2
|
Posted: Wed Jul 19, 2006 11:29 pm Post subject:
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? |
|
| Back to top |
|
 |
Mladen Gogala *nix forums Guru
Joined: 11 Mar 2005
Posts: 948
|
Posted: Thu Jul 20, 2006 1:28 pm Post subject:
Re: Problem with Oracle selecting object types
|
|
|
On Wed, 19 Jul 2006 16:29:38 -0700, sam.lumbroso wrote:
| Quote: | 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 |
|
| Back to top |
|
 |
Mladen Gogala *nix forums Guru
Joined: 11 Mar 2005
Posts: 948
|
Posted: Thu Jul 20, 2006 8:36 pm Post subject:
Re: Problem with Oracle selecting object types
|
|
|
sam.lumbroso@gmail.com wrote:
| Quote: | 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$
| Quote: | 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 |
|
| Back to top |
|
 |
sam.lumbroso@gmail.com *nix forums beginner
Joined: 19 Jul 2006
Posts: 2
|
Posted: Thu Jul 20, 2006 10:28 pm Post subject:
Re: Problem with Oracle selecting object types
|
|
|
Thank you for the response, Mladen. Fortunately, it is not crucial, I
was just looking to simplify my work. |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Mon Dec 01, 2008 8:23 pm | All times are GMT
|
|
Per Insurance | Loans | Anime Downloads | Mortgages | Shares
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|