“ORA-00932: 数据类型不一致: 应为 -, 但却获得 CLOB “一种情况的解决

https://blog.csdn.net/hongweigg/article/details/102562435

问题:

在一个应用项目中,原来运行得好好得,但升级后,却报“ORA-00932: 数据类型不一致: 应为 -, 但却获得 CLOB ”。经查,一表增加了CLOB类型字段,用于存储用户照片数据。

解决:

原报错查询为2个表关联,经过简化,可以得出能导致同样报错的典型SQL句式,见下面第一条SQL:

  1. #报错
  2. select distinct u.* from t_user u,t_org where u.user_id='1';
  3. #不报错
  4. select distinct u.* from t_user u where u.user_id='1';
  5. #不报错
  6. select distinct u.user_id,u.user_baseorgid from t_user u,t_org where u.user_id='1';

经测试,发现带distinct关键字的语句,关联多表查询时,若使用字段全选(select *),则表中含clob字段,就会报上述错误。

解决的办法时,使用distict关键字时,select 子句中不要出现cblod类型的字段。

原文地址:https://www.cnblogs.com/sunny3158/p/14435864.html