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

本文介绍了一种在SQL查询中遇到的数据类型不一致问题,特别是当查询包含CLOB字段时出现的ORA-00932错误。文中提供了两种解决方案:一是通过将CLOB字段转换为字符类型来解决;二是直接移除查询中的去重操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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 去重。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值