ORA-00932 and CMP 2.0
Hi,
I'm using Weblogic 7.0 sp2 with Oracle 8.1.7 and Oci driver, but this also happens
to thin driver.
When using a CMP 2.0 to update a table with 6 DATE fields, when we try to update
one of those columns with null,
it crashes:
java.sql.SQLException: ORA-00932: tipos de dato inconsistentes
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1597)
at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1209)
at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1321)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:509)
at weblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedStatementImpl.java:82)
at weblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatement.java:58)
It only happens with one column. With all the rest, it works fine. We use java.sql.Date
for they all.
Why????????? All the columns are equal, of course, of course they aren't NOT
NULL, and we have checked all
the CMP and it's alright. We have even recreated it several times.
With CMPs containing similar DATE fields but only containing 2 or 3, it always
works fine.
If using SQL directly, it works fine. The problem is only using the CMP 2.0.
We have not tried with CMP 1.1.
Any idea?
Hi,
We have already solved the problem, but we think there is some kind of bug in
Weblogic.
The problem is when we use MetaData as validate-db-schema-with option for our
CMPs. Using this, we suppose there's some kind of problem when mapping CMP with
DB. If we use TableQuery which performs a select when EJBs are deployed, it works
fine, and we can insert null in the field we couldn't before. WHY?? We don't know,
but at least now it works.
I've attached the table script only, as we don't think it has anything to do
with CMP but the group. The problem is with FCHALTA_ITS column. If you need further
information or code, please let me know. If there's any bug or it has already
been solved in Weblogic 8.1, please inform us.
Thank you very much
"Slava Imeshev" <[email protected]> wrote:
Hi Ignacio,
Could you post the table DDL, the full stack trace ant the code of
the
bean?
Regards,
Slava Imeshev
"Ignacio Sanchez" <[email protected]> wrote in message
news:[email protected]...
Hi,
I'm using Weblogic 7.0 sp2 with Oracle 8.1.7 and Oci driver, but thisalso
happens
to thin driver.
When using a CMP 2.0 to update a table with 6 DATE fields, when wetry to
update
one of those columns with null,
it crashes:
java.sql.SQLException: ORA-00932: tipos de dato inconsistentes
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:1597)
at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1209)
at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1321)
atoracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446
atoracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
atoracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
:1900)
atoracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedState
ment.java:363)
at weblogic.jdbc.jts.Statement.executeUpdate(Statement.java:509)
atweblogic.jdbc.rmi.internal.PreparedStatementImpl.executeUpdate(PreparedState
mentImpl.java:82)
atweblogic.jdbc.rmi.SerialPreparedStatement.executeUpdate(SerialPreparedStatem
ent.java:58)
It only happens with one column. With all the rest, it works fine.We use
java.sql.Date
for they all.
Why????????? All the columns are equal, of course, of course they aren'tNOT
NULL, and we have checked all
the CMP and it's alright. We have even recreated it several times.
With CMPs containing similar DATE fields but only containing 2 or 3,it
always
works fine.
If using SQL directly, it works fine. The problem is only using theCMP
2.0.
We have not tried with CMP 1.1.
Any idea?
[table.sql]
Similar Messages
-
ORA-00932 Error using 11g and the SDO_RELATE function. Works fine in 10g
Hello,
If I run this query in Oracle 11g:
SELECT M.FID, MAX(M.VERSION) AS VERSION
FROM SW_PB.A_ROADNODEINFORMATION M, SW_PB.ROADNODE N
WHERE M.REFERENCETOROADNODE = N.FID
AND M.NODEVERSION = N.VERSION
AND M.CATALOGUEID <= 477
AND MDSYS.SDO_RELATE( N.GEOM, MDSYS.SDO_GEOMETRY(2003,81989,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(120000,0,160000,40000)),'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE'
GROUP BY M.FID;
I get an error regarding the N.GEOM field. The error is as follows:
ORA-00932: inconsistent datatypes: expected - got MDSYS.SDO_ELEM_INFO_ARRAY
The same query runs fine on a 10g database with the same data. I've even truncated the N table and still get the error. I've rebuilt the index but it makes no difference and the metadata is exactly the same for this table as it is for other tables that are involved in a similar query.
It looks like a bug to me but just wondered if anyone else had come across this?
Thanks,
Peter.Thanks for the reply. I'm really sorry but I haven't created trace files like this for a very long time and have forgotten the best way to read them. This is the start of the trace file, any help with reformatting it would be greatly appreciated.
Thanks,
Peter.
*** 2009-04-23 17:09:22.902
----- Error Stack Dump -----
*** 2009-04-23 17:09:22.917
ORA-00932: inconsistent datatypes: expected - got MDSYS.SDO_ELEM_INFO_ARRAY
----- Current SQL Statement for this session (sql_id=br02jqdwy2utk) -----
SELECT M.FID, MAX(M.VERSION) AS VERSION
FROM SW_PB.A_ROADNODEINFORMATION M, SW_PB.ROADNODE N
WHERE M.REFERENCETOROADNODE = N.FID
AND M.NODEVERSION = N.VERSION
AND M.CATALOGUEID <= 477
AND MDSYS.SDO_RELATE( N.GEOM, MDSYS.SDO_GEOMETRY(2003,81989,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),MDSYS.SDO_ORDINATE_ARRAY(120000,0,160000,40000)),'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE'
GROUP BY M.FID
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
skdstdst()+114 CALLrel kgdsdst()+0 FB783A0 2
ksedst1()+91 CALLrel skdstdst()+0
ksedst()+50 CALLrel ksedst1()+0 0 1
dbkedDefDump()+298 CALLrel ksedst()+0 0
5
ksedmp()+40 CALLrel dbkedDefDump()+0 3 0
_dbkdaKsdActDriver( CALLreg 00000000 3
)+841
_dbgdaExecuteAction CALLreg 00000000 7B50420 FB79A4C
()+63
dbgdaRunAction()+3 CALLrel dbgdaExecuteAction 7B50420 4D4C148 20C0002
02 ()+0 FB79A4C
dbgdRunActions()+4 CALLrel dbgdaRunAction()+0 7B50420 A789E54
4
dbgdProcessEventAc CALLrel dbgdRunActions()+0 7B50420 A789E74
tions()+446
__VInfreq__dbgdChkE CALLrel _dbgdProcessEventAc 7B50420 120A3370 A789F64
ventKgErr()+237 tions()+0
dbkdChkEventRdbmsE CALLrel dbgdChkEventKgErr( 7B50420 A7C06F4 3A4
rr()+33 )+0
__PGOSF99__ksfpec() CALLrel _dbkdChkEventRdbmsE 3A4
+110 rr()+0
_dbgePostErrorKGE() CALLreg 00000000 120A3370 3A4
+1601
dbkePostKGEkgsf() CALLrel _dbgePostErrorKGE() 120A3370 A772020 3A4
+49 +0
_kgeade()+268 CALLreg 00000000 120A3370 A772020 3A4
kgesev()+54 CALLrel kgeade()+0
kgesec2()+18 CALLrel kgesev()+0 120A3370 A772020 3A4 2
FB7A200
qctErr932()+217 CALLrel kgesec2()+0 120A3370 A772020 3A4 1 1
FB7A468 1 19 FB7A218
qctErrConvertDataT CALLrel qctErr932()+0 995FBCC0 120A3370 F6 FB7A468
ype()+82 7B C2E85B4 995FBCC0 120A3370
FB7A468 0 0 FB7A468 0 204
qecgby()+240 CALLrel qctErrConvertDataT 995FBCC0 120A3370 F6 0 0 7B
ype()+0 C2E85B4
qecpqbcheck()+75 CALLrel qecgby()+0
qecdrv()+161 CALLrel qecpqbcheck()+0 C2ECD7C 0 0 0
qecdrv()+74 CALLrel qecdrv()+0
kkqcttcalo()+383 CALLrel qecdrv()+0 C2EFBAC
kkqctdrvGBP()+1841 CALLrel kkqcttcalo()+0 C2EFBAC 0 C2EFBAC 166A5D4 0 2
__VInfreq__kkqgbpTr CALLrel _kkqctdrvGBP()+0 A730DD8
avChkTran()+193
_qksqbApplyToQbcLoc CALLreg 00000000 A730DD8 FB7A9BC
()+536
qksqbApplyToQbc()+ CALLrel qksqbApplyToQbcLoc
67 ()+0
kkqctdrvTD()+1000 CALLrel qksqbApplyToQbc()+ A730DD8 2EF2DA0 FB7A9BC 0
0
kkqgbpdrv()+88 CALLrel kkqctdrvTD()+0 A754820 995FBDF4 6
kkqdrv()+1520 CALLrel kkqgbpdrv()+0 A754820 995FBDF4
kkqctdrvIT()+698 CALLrel kkqdrv()+0 A754820 0
apadrv()+1205 CALLrel kkqctdrvIT()+0 A754820 995FBDF4
opitca()+1841 CALLrel apadrv()+0 995FBDF4
__PGOSF435__kksFull CALLrel _opitca()+0 A7CC9E4 995FBDF4
TypeCheck()+15
_rpiswu2()+560 CALLreg 00000000 FB7B718
kksLoadChild()+860 CALLrel rpiswu2()+0 AF495220 5 A77DCBB4 16
8 94591E54 5 A77DCBE0 0 FB7B670
615F44 0 FB7B718 0
kxsGetRuntimeLock( CALLrel kksLoadChild()+0 120A3370 AE9130D8 FB7C090
)+1421
kksfbc()+8954 CALLrel kxsGetRuntimeLock( 120A3370 A7CC9E4 FB7C090 3 1
)+0
kkspsc0()+1882 CALLrel kksfbc()+0 A7CC9E4 3 108 FB7D2D8 1BB 0 0
0
kksParseCursor()+1 CALLrel kkspsc0()+0
43
opiosq0()+2028 CALLrel kksParseCursor()+0 FB7C610
kpooprx()+273 CALLrel opiosq0()+0 3 E FB7C734 A4
kpoal8()+729 CALLrel kpooprx()+0 FB7F214 FB7D2D8 1BA 1 0 A4
_opiodr()+1224 CALLreg 00000000 5E 1C FB7F210
_ttcpip()+2733 CALLreg 00000000 5E 1C FB7F210 0
_opitsk()+1278 CALL??? 00000000
opiino()+1067 CALLrel opitsk()+0 0 0
_opiodr()+1224 CALLreg 00000000 3C 4 FB7FC28
opidrv()+807 CALLrel opiodr()+0 3C 4 FB7FC28 0
sou2o()+45 CALLrel opidrv()+0 3C 4 FB7FC28
opimaireal()+130 CALLrel _sou2o()+0 FB7FC1C 3C 4 FB7FC28
opimai()+92 CALLrel opimai_real()+0 2 FB7FC54
OracleThreadStart@ CALLrel opimai()+0
4()+764
77E6482C CALLreg 00000000
00000000 CALL??? 00000000 -
Ora-00932 "expected number got -"... error comes and goes
We have several procedures in a package which get called by an asp.net application. The procedures return a sys_refcursor as an out param, by going OPEN param FOR big complicated query. There are about seven procedures which encapsulate different queries. Sometimes, this package seems to just get into a bad mood.
The symptom is, every time the application calls one of the procedures, it gets back the error "ORA-00932: inconsistent datatypes: expected NUMBER got -", with the line number being the beginning of the "OPEN param FOR" statement. But then, if I open SQL Developer and fiddle around with the package, the error goes away... like, sometimes if I manually invoke one of the procedures in script form from the SQL Developer window, it returns successfully there, and then for the rest of the day the application works fine. Then on some other day the app starts getting the error again. Recompiling the package also sometimes changes the state between erroring and working.
I don't see how the error message can be a real error if these changing circumstances allow the procedure to work sometimes but not other times with the same data. I also don't understand what "got -" is supposed to mean. I'm scared about what will happen if we ship something behaving this way. Any clues out there as to what is going on?I have identified a possible workaround. There's an inner subquery that goes something like this:
SELECT fields FROM ( subquery_a UNION ALL subquery_b ) LEFT OUTER JOIN table_c ON (condition)
This in turn gets outer-joined to another subquery. Anyway, when I rewrite this subquery so there's no inside UNION ALL, the error goes away.
At least in a simplified case.
[edit] It looks like I have to avoid outer Union Alls as well.
[edit] And CONNECT_BY_ROOT.
[edit] And if I don't join one less-essential table. These three conditions actually each lead to three separate errors, any one of which will stop ODP.Net in its tracks though the query runs fine in sql plus or sqldeveloper. Using CONNECT_BY_ROOT causes the "expected NUMBER got -" error (even though the field I'm using it on is varchar2), the UNION ALL causes the internal error, and the harmful join causes a "end-of-file on communication channel". I can cause each of these independently of the other two, and I need three separate workarounds to get my product running!
I am starting to conclude that ODP.Net, which I was ordered to use because it's so much better than the Microsoft driver, is a sack o sewage.
Message was edited by:
pointy
Message was edited by:
pointy -
Hi all,
In my project, I use C# .net and Oracle 11g. I use ADO.NET OracleClob object in my C# code which will be passed to a procedure (procedure defined in a package) where I convert the input clob/wkt geometry into SDO_GEOMETRY using SDO_UTIL.FROM_WKTGEOMETRY and subsequently the GEOMETRY can be pushed into a table as shown below.
PROCEDURE insert_extent(p_key_id IN NUMBER, p_extent IN CLOB) AS
m_geom SDO_GEOMETRY;
BEGIN
m_geom := SDO_UTIL.FROM_WKTGEOMETRY(p_extent);
UPDATE TEMP SET GEOM = m_geom
WHERE IDS = p_key_id;
COMMIT;
END insert_extent;
The above code is working fine for small size clob inputs, but, I have encountered ORA-00932 error when my clob/wkt geometry was more than 30MB in size.
Can any one tell me what is the limitation of size of the clob to convert the CLOB to SDO_GEOMETRY and is there any limitaion on SDO_GEOMETRY datatype object to write the geometry into a table as well via insert/update statement.
Also share your thoughts on how to resolve the issue.
Please let me know if further information is required and thanks for the help in advance.
Regards,
KumarMDSYS.SDO_ORDINATE_ARRAY in sdo_geometry can hold 1048576 numbers:
desc MDSYS.SDO_ORDINATE_ARRAY
MDSYS.SDO_ORDINATE_ARRAY VARRAY(1048576) OF NUMBER -
Case expression and ORA-00932: inconsistent datatypes
I m trying to use the following case condition
select
case
when
count(exception.exception_number) > 1
then 0
else
ENTITY_TYPE_DEF.NAME
end as NAME
In table exception , exception_number has a varchar2 datatype. My requirement is such as if the count of exception number is more than 1 , it should show 0 (integer ) and if not then show name column (varchar2) from table entity_type_def .
My query fails with following error
ERROR at line 7:
ORA-00932: inconsistent datatypes: expected NUMBER got CHAR
Please could someone suggest a workaround for above issue.Whatever is the data type of the first case result, it expects all case results to be the same. The first part of your CASE returns 0 which is a number, it expects the second part to also return a number but it returns a string. Hence the error. You can fix it by returning a string in the first part of your case which you do by putting single quotes around your 0.
CASE WHEN count(exception.exception_number) > THEN '0'
ELSE entity_type_def.name END -
Replace function and ORA-00932 Help
Hi ,
We have field name PARAM of type LONG
values of PARAM are :
1)345
2)[email protected]
3)http://ghf.hq.fde.com:9211/psp/VADEV/EMPLOYEE/FIN/c/
4)kennedy
I am getting ORA-00932 Inconsistent data types expected number got LONG when i ran below SQL .
update tbl_parms set param = 'http://efs.hq.def.com/psp'
where param like 'http%';
Please someone could help in fixing this error .
Also ,I am interetsed to just replace http://ghf.hq.fde.com:9211 with http://efs.hq.def.com
can we do with REPLACE or SUBSTRING functions ? the length of URL may vary .
bye,
KarYou can't refer to LONG columns in WHERE clause
"LONG columns cannot appear in WHERE clauses or in integrity constraints"
see http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adfnstyp.htm#435338
You should think about migrating from LONG to CLOB. But in the mean time, the easiest solution may be to
- dump tbl_parms into a file
- delete the lines you don't need to change
- edit the rows you want to change using an editor (regular expressions will help your search and replace):
- apply as an update script eg
UPDATE TBL_PARMS
SET PARAM='the complete value for a parameter'
WHERE PARAM_ID=3Are any of your parameters longer than 4000 chars? If not, consider simply making a version of the table with PARAM varchar2(4000) andupdating there, using REPLACE, SUBSTR etc.
create table new_params
( id number not null, param varchar2(4000))
begin
for x in (select id, param from tbl_parms)
loop
insert into new_params (id, param) values (x.id, x.param);
end loop;
end;
/HTH
Regards Nigel -
ORA-00932: inconsistent data types: expected NUMBER got BINARY
ORA-00932: inconsistent data types: expected NUMBER got BINARY
Hi,
Could anyone help in resolving my problem?
I m developing cmp beans in Jbuilder X,
My database is Oracle 10g, running on Linux and Application server is Oracle10gAs. Running on Windows.
I can deploy my Entity EJBs OK and look then up using finder methods as long as Ive created the data directly in the database using SQL*Plus for instance.
In the database I have my primary keys defined as type NUMBER
In my EJB the corresponding number fields get mapped as java.math.BigDecimal.
which according to the Oracle JDBC specification is how they are mapped.
Problem:
When I try to create a new database entity through my EJB entity bean I get:-
Error "ORA-00932: inconsistent datatypes: expected NUMBER got BINARY".
The value of the number being used as the primary key in this example is 10.
Eg:-
BigDecimal pk = new BigDecimal(10);
TestBean test = home.create(pk);
The datatype in my EJB Deployment descriptor ejb-jar-xml <pri-key-class> is java.math.BigDecimal>
The jdbc driver defined in my application.xml is
oracle.jdbc.driver.OracleDriverand url="jdbc:oracle:thin..." in the connection.
Ive even tried mapping a datatype as described in the Oracle FAQs but this didnt work.
21. I'm trying to deploy a CMP entity bean with a field type BigDecimal and the table creation fails with an error. How do I work around this?
You have to perform the following steps prior to deploy your application.
o Define the mapping for java.math.BigDecimal in the database-schemas/oracle.xml as follows:
<type-mapping type="java.math.BigDecimal" name="number(20,8)" />o Use this schema in your data-source as follows:-
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="OracleDS"
ejb-location="jdbc/OracleDS"
schema="database-schemas/oracle.xml"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="scott"
password="tiger"
url="jdbc:oracle:thin:@localhost:1521:DEBU"
clean-available-connections-threshold="30"
rac-enabled="false"
inactivity-timeout="30"
/>Further clarification of my problem.
Originally I said the error occurred when deploying EJB's
Correction: I can deploy them OK on the application server However the Error message occurs when I try to create a new EJB entity, the only value required is the Primary key which I pass as type BidDecimal.
If I create entries directly in the database my EJB findByPrimaryKey can find entities OK.
But I cant create new ones through EJB.
What realy baffels me is why I'm able to read data through the connection but not write.
The datatype in my EJB Deployment descriptor ejb-jar-xml <pri-key-class> is java.math.BigDecimal>
The jdbc driver defined in my application.xml is
oracle.jdbc.driver.OracleDriver
and url="jdbc:oracle:thin..." in the connection. -
PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got NUMBER
Hi all,
Wondering if you could assist? I'm exploring User Types and having a small problem. I'm getting the above error for a user type I have created which I'm calling in a function. Here's what my code looks like which I'm running the 'scott' schema for testing purposes
SQL> CREATE OR REPLACE TYPE NBR_COLL AS TABLE OF NUMBER;
2 /
Type created.
SQL> create or replace FUNCTION first_rec_only
2 (
3 NUM_ID IN NUMBER
4 ) RETURN NUMBER IS
5 v_num NBR_COLL;
6 BEGIN
7 select deptno into v_num from dept;
8 RETURN v_num(v_num.FIRST);
9 END first_rec_only;
10 /
Warning: Function created with compilation errors.
SQL> show errors
Errors for FUNCTION FIRST_REC_ONLY:
LINE/COL ERROR
7/4 PL/SQL: SQL Statement ignored
7/11 PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got
NUMBER
SQL>
Any clues to what I'm doing wrong? Cheers.The deptno column is a number, you cannot directly select a number into your type, you need to use your type's constructor.
Something like:
CREATE OR REPLACE FUNCTION first_rec_only (NUM_ID IN NUMBER) RETURN NUMBER IS
v_num NBR_COLL;
BEGIN
SELECT nbr_coll(deptno) INTO v_num from dept;
RETURN v_num(v_num.FIRST);
END first_rec_only;Note that although this will compile, it will throw ORA-01422: exact fetch returns more than requested number of rows when you run it. you need to either use the input parameter as a predicate on your query against dept, use rownum = 1 in the query or use bulk BULK COLLECT INTO, depending on what exactly you want to accomplish.
John -
Binding dynamic variable in XQuery doesn't work: ORA-00932
I have a table with several columns. One of those columns is a XMLType.
My goal is to have a query which selects rows from the table of which the XML column matches certain criteria.
I'm trying following example (JDBC) : http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_xquery.htm#insertedID11
First, I created my own query, which looks like:
select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, "someValue")] return "true"' passing t.xmlColumn)This works as expected. Next, as done in the example, I'm trying to replace the "someValue" with a dynamic variable.
Query then looks like:
select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement[contains(Element, $val)] return "true"' passing t.xmlColumn, :1 as "val")This does not seem to work, neither in SQLDeveloper nor in java.
I always get the :
java.sql.SQLException: ORA-00932: inconsistent datatypes: expected - got CHAR(SQLDeveloper just gives ORA-00932)
When I put $val between quotes (so "$val") then I get no error, but then I get no results either.
I think it will not replace $val in that case but just use it as a literal, so thats not what I want
I also tried to remove "contains" xpath and use the exact same example as on the oracle page
select * from MyTable t, XMLTABLE( xmlnamespaces (DEFAULT 'http://test), 'for $i in /RootElement where $i/SubElement/Key = $val return "true"' passing t.xmlColumn, :1 as "val")But this doens't help either.
I'm clueless about this, so any help would be appreciated
Edited by: user5893566 on Nov 29, 2008 6:24 AMOk, I tested it using the latest enterprise edition (11g) and there it works as expected.
However, on 10.2.0.1.0 and 10.2.0.3.0 it gives this error.
Is this a bug which has been fixed or should I do something special on 10g ?
I installed all of these as normal without any special settings, created the tables and ran the query... -
ORA-00932 Inconsistent datatype
Hi,
Actually i am getting this error when i m running a form having one cursor in
form which is refering a table
cursor a
is
select *
from tableA;
now i compile this in one database ,and if i run it in same db ,it works
but when i run on another database containing similar database structure
(for some columns defaults values for columns is not in database).
So when opening cursor it gives ora-00932.
But when i give list of all columns in select ,it runs.
so can you tell me what can be reason.
Regards,
SSIf the two databases are suppose to be the same (one for test and the other for production), then its generally not a good idea to compile each time. By not compiling, it alerts you to any differences so you can correct them. However, if this is not the case, then you should compile each times as Gerd said.
But when i give list of all columns in select ,it runs.Are you saying this:
cursor a
is
select *
from tableA;
produces error, but this:
cursor a
is
select col1, col2
from tableA;
does not?
If so, lets' see your code for this cursor loop. -
[8i] Case statement generates ORA-00932: inconsistent datatypes
Note: I am working with an 8i database (yes, it is quite old), and in this situation, I have to deal with the datatypes (i.e. CHAR), I am given to work with.
I am attempting to calculate the amount of time product waits between manufacturing steps. As I've discovered though, sometimes I get a negative value when subtracting the date the previous step completes from the date the current step starts. As it is generally impossible to start a later step before an earlier step (imagine trying to screw a cap onto a bottle that doesn't have threads cut yet--it just can't happen), what I've found is that sometimes two steps are started on the same day and finished on the same day (though not necessarily the day they started). This situation CAN happen when one person did both steps and logged on to both steps at the same time, rather than logging on to one, then the other. So, what I need to do in these situations is replace the negative number with a zero (I'll treat the later step as having no wait time).
Here is some sample data:
(Note: the real data set is the result of a query, and has around 200K rows and more columns, but this should be representative enough to find a solution that works on my actual application.)
CREATE TABLE steps
( item_id CHAR(25)
, ord_nbr CHAR(10)
, sub_nbr CHAR(3)
, step_nbr CHAR(4)
, start_date DATE
, finish_date DATE
INSERT INTO steps
VALUES ('A','0000000001','001','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
INSERT INTO steps
VALUES ('A','0000000001','001','0020',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
INSERT INTO steps
VALUES ('A','0000000001','001','0030',TO_DATE('01/05/2011','mm/dd/yyyy'),TO_DATE('01/06/2011','mm/dd/yyyy'));
INSERT INTO steps
VALUES ('A','0000000001','002','0010',TO_DATE('01/01/2011','mm/dd/yyyy'),TO_DATE('01/02/2011','mm/dd/yyyy'));
INSERT INTO steps
VALUES ('A','0000000001','002','0020',TO_DATE('01/04/2011','mm/dd/yyyy'),TO_DATE('01/04/2011','mm/dd/yyyy'));
INSERT INTO steps
VALUES ('A','0000000001','002','0030',TO_DATE('01/06/2011','mm/dd/yyyy'),TO_DATE('01/07/2011','mm/dd/yyyy'));
INSERT INTO steps
VALUES ('B','0000000002','001','0005',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));
INSERT INTO steps
VALUES ('B','0000000002','001','0025',TO_DATE('01/10/2011','mm/dd/yyyy'),TO_DATE('01/12/2011','mm/dd/yyyy'));Here is the query I use that returns negative values sometimes:
SELECT item_id
, ord_nbr
, sub_nbr
, step_nbr
, start_date - last_step_finished
FROM (
SELECT s.*
, LAG (s.finish_date) OVER (
PARTITION BY s.item_id
, s.ord_nbr
, s.sub_nbr
ORDER BY s.step_nbr
) AS last_step_finished
FROM steps s
Returns:
ITEM_ID ORD_NBR SUB STEP START_DATE-LAST_STEP_FINISHED
A 0000000001 001 0010
A 0000000001 001 0020 -1.000
A 0000000001 001 0030 3.000
A 0000000001 002 0010
A 0000000001 002 0020 2.000
A 0000000001 002 0030 2.000
B 0000000002 001 0005
B 0000000002 001 0025 -2.000These are the results I want to see:
ITEM_ID ORD_NBR SUB STEP START_DATE-LAST_STEP_FINISHED
A 0000000001 001 0010
A 0000000001 001 0020 0.000
A 0000000001 001 0030 3.000
A 0000000001 002 0010
A 0000000001 002 0020 2.000
A 0000000001 002 0030 2.000
B 0000000002 001 0005
B 0000000002 001 0025 0.000And this is what I tried to do to get those results (comment notes what line generated the error):
SELECT item_id
, ord_nbr
, sub_nbr
, step_nbr
, CASE
WHEN start_dt - last_step_finished < 0
THEN 0
ELSE start_dt - last_step_finished -- THIS LINE GENERATES THE ORA-00932 ERROR
END AS days_in_queue
FROM (
SELECT s.*
, LAG (s.finish_date) OVER ( PARTITION BY s.item_id
, s.ord_nbr
, s.sub_nbr
ORDER BY s.step_nbr
) AS last_step_finished
FROM steps s
);I know I've had inconsistent datatype errors before with case statements in this particular 8i database, but I can't seem to figure out why I'm getting one this time. I think it has something to do with the NULL values that can occur for last_step_finished. Also, if I change the case statement to:
, CASE
WHEN start_dt - last_step_finished < 0
THEN NULL
ELSE start_dt - last_step_finished -- THIS LINE GENERATES THE ORA-00932 ERROR
END the query runs just fine. But, I don't want NULL, I want 0. In the next level of this query, I will be taking averages by item_id/step_nbr, and I want the 0's to be included in the average. (NULL values, as far as I can tell, would be excluded. AVG(NULL, 1, 2) =AVG (1,2) = 1.5 NOT AVG(0,1,2) = 1).
Thanks in advance!Thanks, TO_NUMBER did the trick. Since you didn't state in your post where to use TO_NUMBER, here is my final solution, in case anyone in the future looks through this thread to find an answer to their question:
SELECT item_id
, ord_nbr
, sub_nbr
, step_nbr
, CASE
WHEN start_dt - last_step_finished < 0
THEN 0
ELSE TO_NUMBER(start_dt - last_step_finished)
END AS days_in_queue
FROM (
SELECT s.*
, LAG (s.finish_date) OVER ( PARTITION BY s.item_id
, s.ord_nbr
, s.sub_nbr
ORDER BY s.step_nbr
) AS last_step_finished
FROM steps s
);Edited by: user11033437 on Jun 27, 2011 11:17 AM
I see you edited your post to add TO_NUMBER to it. -
ORA-00932 when trying to pass ARRAY from Java SP to PL/SQL
Hi all
I am trying to pass ARRAYs back and forth between PL/SQL and Java stored procedures. But I keep getting:
ORA-00932: inconsistent datatypes: expected a return value that is an instance of a user defined Java class convertible to an Oracle type got an object that could not be converted
Here's my PL/SQL:
create or replace type CONTENTP.sentences_array as VARRAY(1000) of CLOB
-- I've also tried .. as TABLE of CLOB and varray/table of VARCHAR2
declare
proc_clob CLOB;
arr SENTENCES_ARRAY;
begin
SELECT document_body
into proc_clob
from documents
where document_id = 618784;
arr := processdocument.sentencesplit (proc_clob);
end;
PROCESSDOCUMENT package definition:
CREATE OR REPLACE PACKAGE CONTENTP.PROCESSDOCUMENT AS
FUNCTION sentenceSplit(Param1 CLOB)
return SENTENCES_ARRAY
AS
LANGUAGE java
NAME 'com.contentp.documents.ProcessDocument.sentenceSplit(oracle.sql.CLOB) return oracle.sql.ARRAY';
FUNCTION removeHTML(Param1 CLOB)
return CLOB
AS
LANGUAGE java
NAME 'com.contentp.documents.ProcessDocument.removeHTML(oracle.sql.CLOB) return oracle.sql.CLOB';
end;
Java sentenceSplit code:
public static oracle.sql.ARRAY sentenceSplit ( CLOB text) throws IOException, SQLException
Connection conn = new OracleDriver().defaultConnection();
String[] arrSentences = sent.getsentences ( CLOBtoString (text) );
ArrayDescriptor arrayDesc =
ArrayDescriptor.createDescriptor ("SENTENCES_ARRAY", conn);
ARRAY ARRSentences = new ARRAY (arrayDesc, conn, arrSentences);
return ARRSentences;
I have confirmed that the String[] arrSentences contains a valid string array. So the problem seems to be the creation and passing of ARRSentences.
I have looked at pages and pages of documents and example code, and can't see anything wrong with my declaration of ARRSentences. I'm at a loss to explain what's wrong.
Thanks in advance - any help is much appreciated!I am trying to do something similar but seems like getting stuck at registerOutParameter for this.
Type definition:
CREATE OR REPLACE
type APL_CCAM9.VARCHARARRAY as table of VARCHAR2(100)
Java Stored Function code:
public static ARRAY fetchData (ARRAY originAreaCds, ARRAY serviceCds, ARRAY vvpcs) {
Connection connection = null;
ARRAY array = null;
try {
connection = new OracleDriver ().defaultConnection();
connection.setAutoCommit(false);
ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", connection);
String[] result = new String [2];
result[0] = "Foo";
result[1] = "Foo1";
array = new ARRAY (adString, connection, result);
connection.commit ();
return array;
} catch (SQLException sqlexp) {
try {
connection.rollback();
} catch (SQLException exp) {
return array;
Oracle Stored Function:
function FETCH_TRADE_DYN_DATA (AREA_CDS IN VARCHARARRAY, SERVICE_CDS IN VARCHARARRAY,VV_CDS IN VARCHARARRAY) return VARCHARARRAY AS LANGUAGE JAVA NAME 'com.apl.ccam.oracle.js.dalc.TDynAllocation.fetchData (oracle.sql.ARRAY, oracle.sql.ARRAY, oracle.sql.ARRAY) return oracle.sql.ARRAY';
Java Code calling Oracle Stored Procedure:
ocs = (OracleCallableStatement) oraconn.prepareCall(queryBuf.toString());
ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", oraconn);
String[] originAreaCds = sTDynAllocationVO.getGeogAreaCds();
ARRAY areaCdArray = new ARRAY (adString, oraconn, originAreaCds);
ocs.registerOutParameter(1, OracleTypes.ARRAY);
ocs.setArray (2, areaCdArray);
String[] serviceCds = sTDynAllocationVO.getServiceCds();
ARRAY serviceCdsArray = new ARRAY (adString, oraconn, serviceCds );
ocs.setArray (3, serviceCdsArray);
String[] vvpcs = sTDynAllocationVO.getVesselVoyagePortCdCallNbrs();
ARRAY vvpcsArray = new ARRAY (adString, oraconn, vvpcs);
ocs.setArray (4, vvpcsArray);
ocs.execute();
ARRAY results = ocs.getARRAY(1);
Error I get:
Parameter Type Conflict: sqlType=2003
Thanks for help in advance. -
ORA-00932 Using Structured XML Table
Hello,
I'm having a problem in trying to create and use a Structured XML Table.
I have created very small sample that illustrates my problem:
I have registered the following schema:
<schema
targetNamespace="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd"
xmlns:jjm="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<complexType name="JjmType">
<choice maxOccurs="unbounded">
<element name = "Key" type = "string"></element>
<element name = "Type" type = "string"></element>
<element name = "AccessID" type = "string"></element>
</choice>
</complexType>
<element name ="Jjm" type="jjm:JjmType"/>
</schema>'
Then I created the following table:
CREATE TABLE JJM_SCHEMA of XMLType
XMLSCHEMA "http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd"
ELEMENT "Jjm";
Then I inserted the following row:
insert into JJM_SCHEMA values(xmltype('<Jjm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd">
<Key>anp</Key>
<Type>User</Type>
<AccessID>TSL2</AccessID>
</Jjm>'));
Then I do the following query:
SELECT
extract(value(x),
'/Jjm[Type="User"]') AS jjmXML FROM JJM_SCHEMA x
WHERE existsNode(value(x),'/Jjm[Type="User"]') = 1;
I get this error:
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected UDT got CHAR
However, if I remove the Xpath predicate [Type="User"] from the "extract()" function and WHERE clause...
SELECT
extract(value(x),
'/Jjm') AS jjmXML FROM JJM_SCHEMA x
WHERE existsNode(value(x),'/Jjm') = 1;
The query works.
Also, If I change the schema from <choice maxOccurs="unbounded"> to <sequence>... either query works.
I need the "choice" type element to work with the Xpath predicate. Am I missing something?
Thanks in advance.
Jim McDowallJim
Which version of the database are you using...
Testing with 9.2.0.4.0 I had to add an xmlns declaration to the instance document before I could insert it into the table
<Jjm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd" xsi:noNamespaceSchemaLocation="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd">
<Key>anp</Key>
<Type>User</Type>
<AccessID>TSL2</AccessID>
</Jjm>
However once that was done I get the following.
SQL*Plus: Release 9.2.0.4.0 - Production on Wed Aug 20 15:40:32 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> spool testcase.log
SQL> set trimspool on
SQL> connect &1/&2
Connected.
SQL> --
SQL> set timing on
SQL> set long 10000
SQL> set pages 10000
SQL> set feedback on
SQL> set lines 132
SQL> --
SQL> SELECT extract(value(x),'/Jjm[Type="User"]') AS jjmXML
2 FROM JJM_SCHEMA x
3 WHERE existsNode(value(x),'/Jjm[Type="User"]') = 1
4 /
JJMXML
<Jjm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tsldev01.thesoftlife.com:7887/SoftTop/S
noNamespaceSchemaLocation="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd">
<Key>anp</Key>
<Type>User</Type>
<AccessID>TSL2</AccessID>
</Jjm>
1 row selected.
Elapsed: 00:00:02.07
SQL> SELECT extract(value(x),'/Jjm') AS jjmXML
2 FROM JJM_SCHEMA x
3 WHERE existsNode(value(x),'/Jjm') = 1;
JJMXML
<Jjm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tsldev01.thesoftlife.com:7887/SoftTop/S
noNamespaceSchemaLocation="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd">
<Key>anp</Key>
<Type>User</Type>
<AccessID>TSL2</AccessID>
</Jjm>
1 row selected.
Elapsed: 00:00:00.00
SQL> /
JJMXML
<Jjm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tsldev01.thesoftlife.com:7887/SoftTop/S
noNamespaceSchemaLocation="http://tsldev01.thesoftlife.com:7887/SoftTop/Schemas/Jjm.xsd">
<Key>anp</Key>
<Type>User</Type>
<AccessID>TSL2</AccessID>
</Jjm>
1 row selected.
Elapsed: 00:00:00.00
SQL> quit -
Error ORA-00932 updating data in worksheet
OK, some of this may be extraneous, but here goes:
Using SQLDeveloper 1.5.1 Build MAIN-5440
I needed to insert a couple of columns into the middle of a table, so I renamed, created, and copied. Both fields are FKs, but are initially null.
So, I go into the data worksheet, change the value of one of them, and then use 'DELETE' to remove that value, and then hit commit, I get:
One error saving changes to table "WWSEBS01"."WWT03495_PT_LKP":
Row 1: ORA-00932: inconsistent datatypes: expected NUMBER got DATE
Another user received "expected NUMBER got TIMESTAMP".
This same operation works just fine on the other fields in the table.
I'm still not sure if this is a feature or a bug. :)
Any ideas?
MichaelMichael,
I am getting exactly the same errors when trying to delete a value from a number datatype column using the worksheet.
I'm also using SQLDeveloper 1.5.1 Build MAIN-5440 and the error given is...
One error saving changes to table "xxxxxx"."xxxxxxx":
Row 1: ORA-00932: inconsistent datatypes: expected NUMBER got DATE
I can change the numeric value to a different non-null value fine and all the other non-number fields can be edited without error.
There is also no issue with setting a numeric value to null using a standard SQL statement from the command line.
This only affects a couple of my tables and maybe related to those where I have changed column names in the past week or so.
I have checked out the xxxTableSettings.xml files but they look fine (i.e the right column names and order) for the affected tables.
I will look further into this but has anyone else got any ideas.
Cheers
Alex -
ORA-00932: inconsistent datatypes: expected - got - In 11g, WORKS in 9i!
Hello,
Involved in migration of a 9i database to 11g, R2. One of our procedures works in 9i but in 11g gives us "ORA-00932: inconsistent datatypes: expected - got - "
We tracked down the error in a statement where oracle does a fetch into a sys_refcursor. The fetch happens on a dynamically constructed select statement ( built by varchar concatenation).
The select statement selects 3 fields, but the fetch into passes 2 variables to the fetch statement. This causes ORA-00932 in 11g R2, but works in 9i.
Below is a modified procedure we built to demonstrate the problem. if you compile and test, you will see that the procedure runs in 9i but not 11g.
create or replace procedure testORA00932 is
v_now date;
v_fsqltext varchar2(2000);
v_curs sys_refcursor;
begin
v_fsqltext := 'select sysdate, sysdate+1 from dual'; -- select 2 fields
open v_curs for v_fsqltext;
loop
fetch v_curs into v_now; -- fetch 1 field, this statement fails in 11g (ORA-00932), works in 9i
dbms_output.put_line(v_now);
exit when v_curs%notfound;
end loop;
close v_curs;
end;
Is there a compatibility flag we can turn on to resove this problem?
Edited by: chrisl08 on Mar 29, 2012 11:11 PMAfter researching this a little more, this is a know bug to oracle: Bug 4381035
According to Oracle, the only available workaround is to provide the same number of define variables as columns in the SELECT statement.
Maybe you are looking for
-
Hi friends, I want to do homogeneous system copy. I want to know the steps in homogeneous copy, and how to create control file from source system for target system. And after that what activity is required . thanks Regards Manoj
-
Copying file from a local computer into mapped LAN share.
I tried to copy a file from a local computer into a Z: disc (a LAN share). I tried to use every method i found on the internet. Using io, nio.. nothing works. It works well on the local computer, but not through LAN. It says that there is not enough
-
Error 'invalid number' ???
I just wanted to do this: SELECT PROJ_TASK.PROJECTID, PROJ_TASK.TASKUNIQUEID, '\\ANDREWS\DD\op\op-l\Service_Orders\' + PROJ_TASK.TEXT_26 + '.pdf' AS Path FROM PROJ_TASK But it gives me an error highlighting '.pdf' ... Im just trying to
-
Hi, Is there a way to use a EVHOT function in a macro? Thanks David
-
Hi, this is the problem ok? I imported photos from my mac to my iphone and now i want to delete it, but when i go to Edit the red botton doesn't appear .. so pleas help me thank you