How to use GROUP BY on a CLOB column with Oracle?
Try this:
SELECT A.T_ID, B.T, MAX(A.V)
FROM bdd.LOG A, bdd.T_B B
WHERE B.T_ID = A.T_ID
GROUP BY A.T_ID, B.T
HAVING MAX(A.V) < 1;
I'm very familiar with the phenomenon of writing queries for a table designed by someone else to do something almost completely different from what you want. When I've had this same problem, I've used.
GROUP BY TO_CHAR(theclob)
and then of course you have to TO_CHAR
the clob in your outputs too.
Note that there are 2 levels of this problem... the first is that you have a clob column that didn't need to be a clob; it only holds some smallish strings that would fit in a VARCHAR2
. My workaround applies to this.
The second level is you actually want to group by a column that contains large strings. In that case the TO_CHAR
probably won't help.