473,738 Members | 8,397 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 3203
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
10754
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
7250
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
1825
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". or &&1.. etc.
5
1886
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 retrieving data from Oracle when an
42
6754
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
4362
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 recordset. For example: CREATE Stored Procedure HelloWorld As
3
3799
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
4035
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
1238
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 VARCHAR2(20)); 'create or replace procedure TEST_SP_UDT (INP1 IN UDT01, OP1 OUT UDT01) AS BEGIN ...
0
8969
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9476
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9263
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.