niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » PHP
Problem with Oracle selecting object types
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
Author Message
sam.lumbroso@gmail.com
*nix forums beginner


Joined: 19 Jul 2006
Posts: 2

PostPosted: Wed Jul 19, 2006 11:29 pm    Post subject: Problem with Oracle selecting object types Reply with 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?
Back to top
Mladen Gogala
*nix forums Guru


Joined: 11 Mar 2005
Posts: 948

PostPosted: Thu Jul 20, 2006 1:28 pm    Post subject: Re: Problem with Oracle selecting object types Reply with quote

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

PostPosted: Thu Jul 20, 2006 8:36 pm    Post subject: Re: Problem with Oracle selecting object types Reply with quote

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

PostPosted: Thu Jul 20, 2006 10:28 pm    Post subject: Re: Problem with Oracle selecting object types Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [4 Posts] View previous topic :: View next topic
The time now is Mon Dec 01, 2008 8:23 pm | All times are GMT
navigation Forum index » Programming » PHP
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Unknown in header problem -SOLVED- Light Speed Postfix 0 Thu Jul 03, 2008 10:40 am
No new posts problem with sending mail nuxia Postfix 0 Mon Apr 21, 2008 3:58 am
No new posts Postfix 2.3.8 Virtual problem Blotto Postfix 0 Fri Apr 04, 2008 6:11 am
No new posts Postfix sending problem for local domain remote email monkey_magix Postfix 0 Mon Sep 10, 2007 10:17 am
No new posts bounce problem murkis Postfix 0 Sun Oct 08, 2006 3:45 pm

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
[ Time: 0.3084s ][ Queries: 16 (0.2215s) ][ GZIP on - Debug on ]