LANGUAGE/!$%!% ERROR NOTE 2017. 1. 30. 17:05

!markdown



### Error (에러)

java.sql.SQLSyntaxErrorException: ORA-00932: 일관성 없는 데이터 유형: -이(가) 필요하지만 CLOB임



### Problem (문제)


Oracle에서 CLOB인 컬럼을 count() 했더니.. 


발생했다.



### Solved (해결)


- D컬럼이 Clob이라고 한다면 다음과 같이 고친다.


BEFORE


```sql

select count(A) as A, 

   count(B) as B, 

   count(C) as C, 

   count(D) as D

from HELLO_TABLE

where A = 1003

```


AFTER

```sql

select count(A) as A, 

   count(B) as B, 

   count(C) as C, 

   count(case when D is null then null else 0 end) as D

from HELLO_TABLE

where A = 1003

```



### Reference (참조)


SQL: use count with Clob: [http://stackoverflow.com/questions/29307976/sql-use-count-with-clob](http://stackoverflow.com/questions/29307976/sql-use-count-with-clob)


[http://www.gurubee.net/article/66014](http://www.gurubee.net/article/66014)