Posted on 2006-04-11
Medium Priority
Last Modified: 2013-11-19
I am getting the following error when I try to compile the following PLSQL script
PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got -.

Does anyone know why I am getting this error?

CREATE OR REPLACE Procedure xmldoc (setid_in in varchar2, customerid_in in VARCHAR2)

   NAME:       xmldoc
   PURPOSE:    Combine multiple xml documents into one xml document.
   Ver        Date        Author           Description
   ---------  ----------  ---------------  ------------------------------------
   1.0        04-10-2006  TCleveland        1. Created procedure.

v_clob    CLOB;


       xmlelement("MESSAGEGROUP", xmlagg(xmlelement("STATE",cust_keys, xmlcontent,
                                               xmlelement("StateMessage",(select xmlagg(xmlelement("Message", cust_keys,xmlcontent, xmlelement("Attributes",(select xmlagg(xmlelement("Attribute", cust_keys, xmlcontent)) from envdbr3.xmledit
                                      where formname='InsuranceFraud_Attribute'
                                                and extractvalue(cust_keys,'/xmlkeys/kv1')=extractvalue(c.cust_keys,'/xmlkeys/kv1')
                                                and extractvalue(cust_keys,'/xmlkeys/kv2')=extractvalue(c.cust_keys,'/xmlkeys/kv2')
                                                and extractvalue(cust_keys,'/xmlkeys/kv3')=extractvalue(c.cust_keys,'/xmlkeys/kv3')
                                                group by extractvalue(cust_keys,'//kv1'),extractvalue(cust_keys,'//kv2'),extractvalue(cust_keys,'//kv3')
                                 )      )) from envdbr3.xmledit c
                                                                      where formname='InsuranceFraud_MessageGroup'
                                                                                and extractvalue(cust_keys,'/xmlkeys/kv1')=extractvalue(x.cust_keys,'/xmlkeys/kv1')
                                                                                and extractvalue(cust_keys,'/xmlkeys/kv2')=extractvalue(x.cust_keys,'/xmlkeys/kv2')
                                                                                group by extractvalue(cust_keys,'//kv1'),extractvalue(cust_keys,'//kv2')
               ) as xmldoc into v_clob
 from envdbr3.xmledit x
where formname='InsuranceFraud_StateGroup'
and extractvalue(cust_keys,'/xmlkeys/kv1/@name')='SET_ID'
and extractvalue(cust_keys,'/xmlkeys/kv1')='0001'
and extractvalue(cust_keys,'/xmlkeys/kv5')= 'AL'
group by extractvalue(cust_keys,'//kv1'),extractvalue(cust_keys,'//kv2');


Question by:TClevel
  • 3

Accepted Solution

csachdeva earned 1500 total points
ID: 16434361
You are getting error due to One of the following:

An attempt was made to perform an operation on incompatible datatypes. For example, adding a character field to a date field (dates may only be added to numeric fields) or concatenating a character field with a long field.
An attempt was made to perform an operation on a database object (such as a table or view) that is not intended for normal use. For example, system tables cannot be modified by a user. Note that on rare occasions this error occurs because a misspelled object name matched a restricted object's name.
An attempt was made to use an undocumented view.
So If the cause is different datatypes, then use consistent datatypes. For example, convert the character field to a numeric field with the TO_NUMBER function before adding it to the date field. Functions may not be used with long fields.
an object not intended for normal use, then do not access the restricted object.
Chetan Sachdeva
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 16439058
99% of the time when you see: "inconsistent datatypes: expected ??? got -" the "-" (dash) involves a LOB.

The output of xmlelement is of XMLTYPE and you are trying to put it into a CLOB.

             ) as xmldoc into v_clob
             ).getclobval() as xmldoc into v_clob
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 16439080
Forgot to add:
The code you provided seems a bit much just to merge several XML docs into a single doc.  I'd be happy to try to give you some other possible options if you can provide a little more detail about the problem.  If you want me to look into this more, please provide me the full Oracle version you are on.
LVL 78

Expert Comment

by:slightwv (䄆 Netminder)
ID: 16884928
I'm afraid I have to disagree with the recommendation.  I don't think that pasting the text from the error code from the online documentation should ever get points.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question