select to_char(ed.created_date,'mm/dd/yy') Created_Date,
TRIM(ed.ERRORMSG) ErrorMsg,
to_char(substr(eventdata,instr(eventdata,'<ns0:SiteContractNumber>')+24,
instr(eventdata,'</ns0:SiteContractNumber>') - instr(eventdata,
'<ns0:SiteContractNumber>')-24)) SiteContractNumber,
to_char(substr(eventdata,instr(eventdata,'<ns0:ContactNumber>')+19,
instr(eventdata,'</ns0:ContactNumber>') - instr(eventdata,
'<ns0:ContactNumber>')-19)) ContactNumber,
to_char(substr(eventdata,instr(eventdata,'<ns0:LineItemNumber>')+20,
instr(eventdata,'</ns0:LineItemNumber>') - instr(eventdata,
'<ns0:LineItemNumber>')-20)) LineItemNumber,
to_char(substr(eventdata,instr(eventdata,'<ns0:StartDate>')+15,
instr(eventdata,'</ns0:StartDate>') - instr(eventdata,
'<ns0:StartDate>')-15)) StartDate,
to_char(substr(eventdata,instr(eventdata,'<ns0:EndDate>')+13,
instr(eventdata,'</ns0:EndDate>') - instr(eventdata,
'<ns0:EndDate>')-13)) EndDate,
to_char(substr(eventdata,instr(eventdata,'<ns0:ProductNumber>')+19,
instr(eventdata,'</ns0:ProductNumber>') - instr(eventdata,
'<ns0:ProductNumber>')-19)) MaterialNumber,
to_char(substr(eventdata,instr(eventdata,'<ns0:ProductDescription>')+24,
instr(eventdata,'</ns0:ProductDescription>') - instr(eventdata,
'<ns0:ProductDescription>')-24)) ServicePartDescription,
to_char(substr(eventdata,instr(eventdata,'<ns0:SLANumber>')+15,
instr(eventdata,'</ns0:SLANumber>') - instr(eventdata,
'<ns0:SLANumber>')-15)) ServicePartNumber,
to_char(substr(eventdata,instr(eventdata,'<ns0:Description>')+17,
instr(eventdata,'</ns0:Description>') - instr(eventdata,
'<ns0:Description>')-17)) PHONECOVERAGE
from exception e, exception_detail ed
where e.jmsid = ed.jmsid
and e.timeoccured > trunc(sysdate - 2)
and (projectname like '%delta4%' or projectname like '%delta9%')
and projectname = 'PROD2-Createinfo'
and ed.ERRORMSG not like '%error generated by Abort_Process%'
order by 1 DESC, 3