I have a column named data_column, it has some value like “123123,12,123123”. I want to count rows grouped by the second one.
But when i run
select count(*) from table group by regexp_substr(data_column,'[^,]+',1,2);
It gives
ORA-00932: incostintent datatypes: expected: – got: CLOB
00932. 00000 – “inconsistent datatypes: expected %s got %s”
Cant i group by a regex substring?
the problem doesn’t come from the
regexp_substrfunction but from your column data type:Here you see that the function behaves correctly, however Oracle (tested with 10.2) doesn’t allow you to group with a clob column:
You can convert the function output to a VARCHAR2 to perform the GROUP BY: