添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
){outline:none;box-shadow:none;}select::-ms-expand{;}:root,:host{--chakra-vh:100vh;}@supports (height: -webkit-fill-available){:root,:host{--chakra-vh:-webkit-fill-available;}}@supports (height: -moz-fill-available){:root,:host{--chakra-vh:-moz-fill-available;}}@supports (height: 100dvh){:root,:host{--chakra-vh:100dvh;}}
Link to home
Create Account Log in
Avatar of henderxe
henderxe

asked on

ORA-01790: expression must have same datatype as corresponding expression

Hi All:
I cannot find what is causing the following error.   It is supposed to return counts (e.g.
{"COLUMNS":["SOLICIT","CON TACT","DEC EASED","LO ST"],"DATA ":[[348,38 1,0,0]]})
===================  START ERROR  ========================== ===
Detail
[Macromedia][Oracle JDBC Driver][Oracle]ORA-01790: expression must have same datatype as corresponding expression
Extended Info
Tag Context
R:\aihtc\ART_TEST\model\id ListGenera tion\idLis tGeneratio nDAO.cfc (144)<br>
R:\aihtc\ART_TEST\views\cf m\exportRe ports\idLi stGenerati on\getSoli citCount.c fm (54)<br>
C:\inetpub\wwwroot\MachII\ framework\ ViewContex t.cfc (107)<br>
C:\inetpub\wwwroot\MachII\ framework\ EventConte xt.cfc (468)<br>
C:\inetpub\wwwroot\MachII\ framework\ commands\V iewPageCom mand.cfc (85)<br>
C:\inetpub\wwwroot\MachII\ framework\ EventHandl er.cfc (81)<br>
C:\inetpub\wwwroot\MachII\ framework\ RequestHan dler.cfc (379)<br>
C:\inetpub\wwwroot\MachII\ framework\ RequestHan dler.cfc (327)<br>
C:\inetpub\wwwroot\MachII\ framework\ RequestHan dler.cfc (271)<br>
C:\inetpub\wwwroot\MachII\ framework\ RequestHan dler.cfc (201)<br>
C:\inetpub\wwwroot\MachII\ mach-ii.cf m (123)<br>
R:\aihtc\ART_TEST\index.cf m (9)<br>
===================  END ERROR  ========================== ===
Here's the trail:
NOTE:  Sorry .  .  . I don't know how to "paste" so that the data scrolls.
1.  Clicking on a form (once filled in)  - "getSolicitCount.cfm"   form below  .  .  .
NOTE:  Line 54 is marked.
=================  START  getSolicitCount.cfm Form ======================
<cfif url.event eq "generateIDLIst">
<cfset db = StructNew() />
<cfset  db.dbname = getProperty("dbName")>  <!--- getting dbname from machii.xml  --->
<cfset db.dbUserName = getProperty("dbUserName")>
<cfset  db.dbPassword = getProperty("dbPassword")>
<cfset rootFolder = getProperty("rootFolder")>
<cfset  queryToCSV = createObject("component"," #rootFolde r#.utils.q ueryToCSV" ).init()/>
<cfoutput>
<cfset  idListGenerationObj       =  createObject("component"," #rootFolde r#.model.i dListGener ation.idLi stGenerati onDAO").in it(db.dbna me,db.dbUs erName,db. dbPassword )>
</cfoutput>
<cfset getSolicitCount = idListGenerationObj.getIDl ist(url.ap pealOrProg Code,url.i sSolicit,u rl.queryID ,url.typeO fSolicit,u rl.hiIDObj ,url.from, url.mailin gList,url. contactTyp e)>
<!--- <cfdump var="#getSolicitCount#"><c fabort>   RETURNS DATA  w/ myQuery --->
<cfset columnList = ArraytoList(getSolicitCoun t.GetColum nNames())>
<!--- <cfdump var="#columnList#"><cfabor t> RETURNS COLUMN NAMES --->
<cfset strOutput = queryToCSV.QueryToCSV(
Query=getSolicitCount,
Fields=columnList
<!--- <cfdump var="#strOutput#"><cfabort > WORKS  -  COMBINES DATA AND COLUMN NAMES --->
<cfheader name="content-disposition" value="attachment; filename=contactList.CSV" />
<cfcontent type="text/plain" /><cfoutput>#strOutput#</c foutput>
<cfelse>
<!--- <cfdump var="#url.event#"><cfabort > --->
<cfprocessingdirective suppresswhitespace="yes" >
<cfsetting enablecfoutputonly="1" showdebugoutput="0">
<cfcontent type="application/x-javasc ript">
<cfsilent>
<cfparam name="FORM.appealOrProgCod e" default="" />  <!--- CHANGED from "appealCode" 4/26/2011 --->
<cfparam name="FORM.isSolicit" default="" />
<cfparam name="FORM.queryID" default="" />
<cfparam name="FORM.typeOfSolicit" default="" />
<cfparam name="FORM.hiIDObj" default="" />
<cfparam name="FORM.from" default="" />
<<<<<<< .mine
<!---<cfdump var="#form#"><cfabort>--->
=======
<!---<cfdump var="#form#"><cfabort> --->
>>>>>>> .r941
<cfset db = StructNew() />
<cfset  db.dbname = getProperty("dbName")>  <!--- getting dbname from machii.xml  --->
<cfset db.dbUserName = getProperty("dbUserName")>
<cfset  db.dbPassword = getProperty("dbPassword")>
<cfset rootFolder = getProperty("rootFolder")>
<cfset tmpArray    = ArrayNew(1) >
<cfoutput>
<cfset  idListGenerationObj             =  createObject("component"," #rootFolde r#.model.i dListGener ation.idLi stGenerati onDAO").in it(db.dbna me,db.dbUs erName,db. dbPassword )>
</cfoutput>
LINE 54    <cfset getSolicitCount = idListGenerationObj.getSol icitCount( FORM.appea lOrProgCod e,FORM.isS olicit,FOR M.queryID, FORM.typeO fSolicit,F ORM.hiIDOb j,FORM.fro m)>
<!--- <cfdump var="#getSolicitCount#"><c fabort> --->
<cfset data =   serializeJson(getSolicitCo unt)>
<cfcontent type="application/json"  reset="true">
</cfsilent>
<cfoutput>#data# </cfoutput>
</cfprocessingdirective>
</cfif>
====================== END "getSolocitCount.cfm" Form =======================
retSolocitCount.cfm calls the following function (SHOWSTEP4):
==================== START  "SHOWSTEP4"  FUNCTION  ======================
function showStep4(queryID,hiIDObj, isGenerate List,from)
document.getElementById('c ountDetail sStep4').s tyle.displ ay = "block";
document.getElementById('c ountDetail sStep5').s tyle.displ ay = "block";
if(isGenerateList == 'Yes')
// alert(hiIDObj)
hiIDObj = document.getElementById(hi IDObj).che cked
// alert(hiIDObj)
var appealOrProgCode = "";
var typeOfSolicit = "";
var isSolicit  = getCheckedValue('isSolicit YesNoDiv')
if(isSolicit == "Yes") {
var typeOfSolicit = getCheckedValue('typeOfSol icitations Div')
//alert(typeOfSolicit)
var isSolicit = getCheckedValue('isSolicit YesNoDiv')
var appealOrProgCode = document.getElementById('s olicitYesA ppealCode' ).value
solicitCountDetails(queryI D,typeOfSo licit,appe alOrProgCo de,isSolic it,hiIDObj ,from)
document.cookie = "appealOrProgCode="+docume nt.getElem entById('s olicitYesA ppealCode' ).value;
document.cookie = "hiIDObj="+hiIDObj;
if (reloadStep4Grid == 0)      {
fillmyIDList(queryID,typeO fSolicit,a ppealOrPro gCode,isSo licit,hiID Obj,from);
$("#includeMailingList").m ultiSelect ({ oneOrMoreSelected: '*' });
} else {
$("#list_idListGeneration" ).trigger( "reloadGri d");
reloadStep4Grid = 1;
var typeOfSolicit = getCheckedValue('typdOfInf oNeeded')
var appealOrProgCode = document.getElementById('g iftAppeals ProgramDIL ist1_hdn') .value
//var appealOrProgCode = document.getElementById('i ncludeMail ingList_hd n').value
var isSolicit = getCheckedValue('isSolicit YesNoDiv') ;
solicitCountDetails(queryI D,typeOfSo licit,appe alOrProgCo de,isSolic it,hiIDObj ,from);
//fillmyIDList(queryID,typ eOfSolicit ,appealOrP rogCode,is Solicit,hi IDObj,from );
document.cookie = "appealOrProgCode="+docume nt.getElem entById('g iftAppeals ProgramDIL ist1_hdn') .value;
document.cookie = "hiIDObj="+hiIDObj;
if (reloadStep4Grid == 0)      {
fillmyIDList(queryID,typeO fSolicit,a ppealOrPro gCode,isSo licit,hiID Obj,from);
$("#includeMailingList").m ultiSelect ({ oneOrMoreSelected: '*' });
} else {
$("#list_idListGeneration" ).trigger( "reloadGri d");
reloadStep4Grid = 1;
if(isGenerateList == 'Yes') {
var mailingList  = "xyz";
mailingList = document.getElementById('i ncludeMail ingList_hd n').value
url  = "index.cfm?event=generateI DLIst&quer yID="+quer yID+"&type OfSolicit= "+typeOfSo licit+"&ap pealOrProg Code="+app ealOrProgC ode+"&isSo licit="+is Solicit+"& hiIDObj="+ hiIDObj
+"&from="+from+"&mailingLi st="+maili ngList
window.open(url)
function includeHIIDInContactlist(h iIDObj)
//alert(hiIDObj.checked)
if(hiIDObj.checked)
//      alert('Include HiId')
//alert('removeHiID')
function validateAppealCode(fldObj)
var fldValue = fldObj.value;
var fldValuetoText = fldValue.substring(0,5)
if(fldValue.length > 5)
// alert("Appeal code should be max 5 characters")
//  document.getElementById('s olicitYesA ppealCode' ).value = fldValuetoText
document.getElementById('g enerateCOu nt').style .display = "none";
document.getElementById('i dMaxLimitE rrorDispla y').style. display = "block";
else if(fldValue.length == 5)
document.getElementById('g enerateCOu nt').style .display = "block";
document.getElementById('i dMaxLimitE rrorDispla y').style. display = "none";
else if(fldValue.length < 5)
document.getElementById('g enerateCOu nt').style .display = "none";
document.getElementById('i dMaxLimitE rrorDispla y').style. display = "none";
function  showListGenerateButton      ()
document.getElementById('g enerateCOu nt').style .display = "block";
==================== END  "SHOWSTEP4"  FUNCTION  ======================
2..   SHOWSTEP4 calls function SOLICITCOUNT DETAILS below:
==================== START "SOLICITCOUNTDETAILS"  FUNCTION  ===============
function solicitCountDetails(queryI D,typeOfSo licit,appe alCode,isS olicit,hiI DObj,from) {
document.getElementById('s olicit_gen erateCount ').style.d isplay = "none";
document.getElementById('s olicitCoun t_processi ng').style .display = "block";
//$("#"+type).html("");
//alert(appealCode); return;
//var unicode=evt.keyCode? evt.keyCode : evt.charCode
// alert(unicode)
$.ajax(
type: "post",
//      url:  "views/cfm/AJAXCalls/getFo rmData.cfm ",
url:  "index.cfm?event=getSolici tCount",
data: {
appealCode : appealCode,
isSolicit : isSolicit,
queryID : queryID,
typeOfSolicit  :  typeOfSolicit ,
hiIDObj :hiIDObj,
from :from
dataType: "json",
success: function(objResponse)
//alert(objResponse); return;
var solictCount = objResponse.DATA[0][0];
var idListContactCount = objResponse.DATA[0][1];
if(idListContactCount == null)
idListContactCount = 0;
var idListDeceCount = objResponse.DATA[0][2];
if(idListDeceCount == null)
idListDeceCount = 0;
var idListLostEntity = objResponse.DATA[0][3];
if(idListLostEntity == null)
idListLostEntity = 0;
$("#idListSolicitCount").h tml("");
$("#idListSolicitCount").h tml(solict Count);
$("#idListContactCount").h tml("");
$("#idListContactCount").h tml(idList ContactCou nt);
$("#idListDeceCount").html ("");
$("#idListDeceCount").html (idListDec eCount);
$("#idListLostEntity").htm l("");
$("#idListLostEntity").htm l(idListLo stEntity);
document.getElementById('s olicit_gen erateCount ').style.d isplay = "block";
document.getElementById('s olicitCoun t_processi ng').style .display = "none";
error: function(xhr, objRequest, strError){
//alert(xhr.responseText); return;
document.getElementById('s olicit_gen erateCount ').style.d isplay = "block";
document.getElementById('s olicitCoun t_processi ng').style .display = "none";
==================== END  "SOLICITCOUNTDETAILS"  FUNCTION  ===============
3.   DOLICITCOUNTDETAILS eventually points to a Coldfusion METHOD ("getSolicitCount"), via a Mach-ii event,  which ultimately displays the error above.  LINE 144 is maeked below.
===========  START "IDLISTGENERATIONDAO.CFC"   (GETDOLICITCOUNT)  =======
<cffunction name="getSolicitCount" access="public" returntype="any"><!---   Populate city based on the state we have selected --->
<cfargument name="appealOrProgCode" type="string" required="yes">  <!--- CHANGE NAME ???? --->
<cfargument name="isSolicit" type="string" required="yes">
<cfargument name="queryID" type="string" required="yes">
<cfargument name="solicitType" type="string" required="yes">
<cfargument name="hiIDObj" type="string" required="yes">
<cfargument name="from" type="string" required="yes">
<cfset typecode = "">
<cfif from eq "myQuery">
<cfquery name="getIDListQueryForQue ryID"  datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#" >
select  idList_query  from art_query where query_id = #queryID#
</cfquery>
<cfloop query="getIDListQueryForQu eryID" startrow="1">
<cfset queryFromCLOB = getIDListQueryForQueryID.i dList_quer y>
</cfloop>
<cfset queryFromCLOB = #Replace(queryFromCLOB, "''", "'", "all")# >
<!--- <cfdump var="#getIDListQueryForQue ryID#"><cf abort> SHOWS TWO(2) DIFFERENT FORMATS--->
<cfelse>
<cftry>
<cfquery name="getIDsFromID"  datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#" >
SELECT
list_values
art_idlist
WHERE
idList_id = #queryID#
</cfquery>
<cfset listID = getIDsFromID.list_values >
<!--- <cfdump var="#listID#"><cfabort> --->
<cfstoredproc procedure="addIdLists"    datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#" >
<cfprocparam type="In"   cfsqltype="cf_sql_varchar" variable="id_no"  value="#getIDsFromID.list_ values#">
</cfstoredproc>
<cfcatch type="any" >
<cfset getProgCodeFromAppealCode = "#cfcatch.sql#">
<cfreturn getProgCodeFromAppealCode>
</cfcatch>
</cftry>
<!--- <cfset queryFromCLOB =     " select  lpad(vals,10,'0') id_number from tempIdlists "> --->
<cfset queryFromCLOB =   "select distinct to_number(vals) as  id_number from tempIdlists ">
<cfset queryFromCLOB = #Replace(queryFromCLOB, "''", "'", "all")# >
</cfif>
<cfif  isSolicit  eq "Yes">
<cfif solicitType eq "email">
<cfset typecode = "'EZZ','TEZ','TZZ','ZZZ' ">
<cfelseif solicitType eq "postal">
<cfset typecode = "'MZZ','TMZ','TZZ','ZZZ' ">
<cfelseif solicitType eq "telemarketing">
<cfset typecode = "'PZZ','TPZ','TZZ','ZZZ' ">
</cfif>
<cfquery name="getProgCodeFromAppea lCode"  datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#" >
select program_code from advance.tms_program
where program_code in (select program_code from advance.appeal_header  where appeal_code in ('#appealOrProgCode#'))
</cfquery>
<cfset programCode = "#getProgCodeFromAppealCod e.program_ code#">
<cfelse>
<cfif solicitType eq "email">
<cfset typecode = "'EZZ','ZZZ' ">
<cfelseif solicitType eq "postal">
<cfset typecode = "'MZZ','ZZZ' ">
<cfelseif solicitType eq "telemarketing">
<cfset typecode = "'PZZ','ZZZ' ">
</cfif>
<cfset programCode = "#appealOrProgCode#">
</cfif>
<cfset queryToGetIDFromSolicit = "
select qry1.id_number from (#queryFromCLOB# ) qry1
minus
SELECT distinct
advance.handling.id_number
(#queryFromCLOB# )msu_temp_ai_coni_hnd1,
advance.handling
where
msu_temp_ai_coni_hnd1.id_n umber = advance.handling.id_number and
advance.handling.hnd_statu s_code = 'E'
and advance.handling.hnd_type_ code in (#preserveSingleQuotes(typ ecode)#)
and (
advance.handling.lift_dt = '00000000'
or advance.handling.lift_dt = ' '
or advance.handling.lift_dt > '#dateFormat(now(),'YYYYMM DD')#'
rtrim(advance.handling.pro gram_code) is null
or advance.handling.program_c ode in ('#programCode#')  ) "/>
<!--- JUST ADDED
<cfset queryToGetIDFromSolicit = #Replace(queryToGetIDFromS olicit, "''", "'", "all")# >  --->
<cfset hiIDUnionQuery = "  union select hi_id from
ART_MANUSCRIPT where id_number in(
select qry1.id_number from (#queryFromCLOB# ) qry1
minus
SELECT distinct
advance.handling.id_number
(#queryFromCLOB# )msu_temp_ai_coni_hnd1,
advance.handling
where
msu_temp_ai_coni_hnd1.id_n umber = advance.handling.id_number and
advance.handling.hnd_statu s_code = 'E'
and advance.handling.hnd_type_ code in (#preserveSingleQuotes(typ ecode)#)
and (
advance.handling.lift_dt = '00000000'
or advance.handling.lift_dt = ' '
or advance.handling.lift_dt > '#dateFormat(now(),'YYYYMM DD')#'
rtrim(advance.handling.pro gram_code) is null
or advance.handling.program_c ode in ('#programCode#')  ) "/>
<!--- JUST ADDED
<cfset hiIDUnionQuery = #Replace(hiIDUnionQuery, "''", "'", "all")# > --->
<!--- <cftry> --->
<cfquery name="resultSet"  datasource="#db.dbName#"  username="#db.dbUserName#" password="#db.dbPassword#" >
<!--- select '23' as solicit, '24' as contact, '25' as deceased, '26' as Lost from dual --->
select
sum(decode(solicitation,'Y ','1','0') ) as solicit,
sum(decode(deceased||lost_ status,'00 ','1','0') )as contact ,
sum(deceased) deceased ,
sum(lost_status) Lost
from ART_MANUSCRIPT
where id_number in
((#preserveSingleQuotes(qu eryToGetID FromSolici t)#)
<cfif hiIDObj eq "true">
LINE:  144                               #preserveSingleQuotes(hiID UnionQuery )#)
</cfif>
</cfquery>
<!--- <cfcatch type="any">
<cfset error = "#cfcatch.sql#">
<cfreturn error/>
<cfcatch type="any">
<cfrethrow>
</cfcatch>
</cftry>   --->
<cfreturn resultSet>
</cffunction>
==============  START "IDLISTGENERATIONDAO.CFC"  (GETDOLICITCOUNT) ======
Any assistane is grestly appreciated!
Thanks!
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Here is more explanation of the error.. is there a select in which you are using UNION ?
http://www.techonthenet.com/oracle/errors/ora01790.php
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Really appreciate your comments.   I had looked up the error, and had a fairly good idea of what the problem was, but could not determine "where" the differences in data types existed.
I've tried manipulating both to_char, and to_number many times to no avail.
And to brijeshchauhan's question, yes, there are a few "unions", and "minus" in the code.  The error is right after the "minus", so that's where I was focused.
The query mentioned by OP_Zaharin merely gets counts in each of the categories based eventually on ID_NUMBER, which is identical to HI_ID, except HI_ID refers to joint (e.g. married), while ID_NUMBER is the unique identifier in the database.
But you both seem to zero in on "unions", in particular, so I'll go back and take a closer look at them.
I also apologize for not presenting it better.  The code looks a mess -- realized it after it was posted.
But again, thank you both for a clue that may help me get this resolved.  If it turns out to be another issue, I'll re-post.
Take care!
"The code looks a mess -- realized it after it was posted."