Reputation: 372
I have this query:
select LENGTH(NVL(exam.vl_result,' ')) from exam;
And I got this error: ORA-00932: inconsistent datatypes: expected - got CLOB
The column vl_result
is CLOB, but I need to use NVL in this case. Is there any way to use NVL with datatype CLOB? If not, what can be the best way to get a similar query.
Upvotes: 0
Views: 2385
Reputation: 1270431
Hmmm . . . how about running length()
first:
coalesce(length(exam.vl_result), 1)
Upvotes: 1
Reputation: 35920
Use case..when
as follows:
select case when exam.vl_result is null then 1
else LENGTH(exam.vl_result)
end
from exam;
Note: To find the length of clob use dbms_lob.getlength
Upvotes: 1