日期:2014-05-16  浏览次数:20763 次

一种CLOB异常问题解决方案
这条语句总是报:ORA-00932: 数据类型不一致: 应为 -, 但却获得 BLOB
select * from (
  select rownum as r, t.* from (
  select a.id, a.dir, a.dirFlag, a.createTime, a.latelyTime, a.gcrms, a.title, a.siteName, a.status, b.name as statusName, l.name as defectLevelName, a.currentHandle, a.progressAndPlan, a.frontperson, ds.name as sourceName, c.fullname as currentHandleName, 
  case when a.occurrenceTime + (l.days - l.alert) < sysdate then 0 else 1 end isOverTime from defect1 a left join user_info c on a.currentHandle = c.user_id,dir_status b,dir_defectlevel l,dir_source ds
   where 1 = 1  and a.status = b.id and a.status<>99  and a.defectlevel = l.id and ds.id = a.source and createPerson=92 
order by createTime desc  ) t where rownum <=  20 ) where r > 0


解决方案:删掉distinct 去重复的单词
select * from (
  select rownum as r, t.* from (
  select distinct a.id, a.dir, a.dirFlag, a.createTime, a.latelyTime, a.gcrms, a.title, a.siteName, a.status, b.name as statusName, l.name as defectLevelName, a.currentHandle, a.progressAndPlan, a.frontperson, ds.name as sourceName, c.fullname as currentHandleName, 
  case when a.occurrenceTime + (l.days - l.alert) < sysdate then 0 else 1 end isOverTime from defect1 a left join user_info c on a.currentHandle = c.user_id,dir_status b,dir_defectlevel l,dir_source ds
   where 1 = 1  and a.status = b.id and a.status<>99  and a.defectlevel = l.id and ds.id = a.source and createPerson=92 
order by createTime desc  ) t where rownum <=  20 ) where r > 0