473,549 Members | 2,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3192
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_n ame 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**********@gm ail.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_collect ion($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_nam e($sth, ":addr", $addr, -1, SQLT_NTY);
oci_execute($st h);
while (oci_fetch($sth )) {
var_dump($addr) ;
}
?>
bash-3.1$ php object.php

Warning: oci_new_collect ion(): ORA-22318: input type is not an array
type in c:\tmp\object.p hp 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
10726
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures execute in the database server with better performance? Please advise good references for Oracle stored procedures also. thanks!!
4
7224
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript to make ODBC calls to the db. The particular system I'm working with, will not work with an Oracle stored procedure I'm told. However, it
2
1817
by: _link98 | last post by:
Does IBM publish a complete list of features (of Oracle) which the IBM migration toolkit does *not* convert? The docs seem rather vague. For example: 1. What support for the oracle object-relational features (objects and member procedures etc). 2. any support for removing substitutable parameters in DDL (in sqlplus scripts) like "&&1"....
5
1877
by: dananrg | last post by:
I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g: import dbi, odbc ....and it seems to meet my needs. I'd rather use a module that comes natively with Python if it works (don't care about performance in this particular use case; just that it works). The only issue I've had so far is...
42
6711
by: Paul | last post by:
Anyone know where I can find some good resources to help us choose between SQL and Oracle ( Progress Openedge as well ) . Any comments on what you would choose ?? We are creating a new Warehouse Management System which wil manage our very large inventory. Anyway comments suggestions welcome Thanks Paul
1
4351
by: Chad | last post by:
Hi, I am a SQL Server programmer using Oracle for the first time. In our .NET client apps which use a SQL Server back end, we would use Stored Procedure exclusively for all database access for increased security as well as the pre-compiled advantage. To minimize trips to the db server, we would often call SPs that return more than one...
3
3792
by: Tony Marston | last post by:
I am using PHP 4.4.4 with Oracle 10g Express Edition on Windows XP. I am trying to emulate in Oracle the SET datatype in MySQL and the ARRAY datatype in PostgreSQL I have the created a user-defined datatype as follows: CREATE OR REPLACE TYPE t_fav_food IS VARRAY(10) OF NUMBER(2);
19
4016
by: Gregor =?UTF-8?B?S292YcSN?= | last post by:
Hi! I'm using DB2 database on one server and ORACLE database on the second one. I want to move some data from ORACLE database to DB2 database and update some columns on ORACLE database so I know what rows were transfered. I'd like to do this in a distributed XA transaction and Java. :) How is this possible ? Best regards, Kovi
0
1229
by: prasadbodas2000 | last post by:
Hi, I need a sample code in ASP or VB wherein ADO command object is used to invoke oracle stored procedure. The stored procedure (SP) should have oracle specific custom data types (CDT) as input/output arguments. Consider following statements to define CDT and SP in Oracle. CREATE OR REPLACE TYPE UDT01 AS OBJECT (UNAME VARCHAR2(20), PWD...
0
7521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7959
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7473
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1944
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.