java.sql.SQLException: ORA-00932: 数据类型不一致: 应为 -, 但却获得 CLOB

select distinct a.id,
                a.currentHandle,
                a.progressAndPlan,
                a.customerService,
                c.fullname as customerServiceName,
                d.fullname as currentHandleName
  from defect1 a
  left join user_info c on a.customerService = c.user_id
  left join user_info d on a.currentHandle = d.user_id
  left join site1_attr e on a.siteID = e.site_id, dir_status b
where 1 = 1
   and a.status = b.id
   and a.createTime >=
       to_date('2012-03-01 00:00:00', 'yyyy-mm-dd HH24:mi:ss')
   and a.createTime <=
       to_date('2012-03-31 23:59:59', 'yyyy-mm-dd HH24:mi:ss')
   and a.B_versionName = 'OCS R002C02LG0305'
   order by createTime desc

总是报:ORA-00932: 数据类型不一致: 应为 -, 但却获得 CLOB

是由于这个a.progressAndPlan字段clob字段。

第一种解决方法: a.progressAndPlan 改成 to_char(a.progressAndPlan)。
第二种解决方法: 去掉distinct 去重。
第三种解决方法: 在下一篇文章中。

猜你喜欢

转载自tangzlboy.iteye.com/blog/1500155