troubleshooting Question

Convert an NClob to Character in Oracle

Avatar of Shaunsmith
ShaunsmithFlag for United States of America asked on
DatabasesOracle DatabaseSQL
2 Comments1 Solution625 ViewsLast Modified:
My requirement is to be able to do a distinct on a Table that has a Nclob

select distinct comment from finance_comments ;

Now since comment is a Nclob the DB does not allow me to use a distinct .

I was hoping to use "DBMS_LOB.SUBSTR" to convert it to chars .


SELECT distinct DBMS_LOB.SUBSTR(comments,4000,1)
FROM finance_comments

when I try to do this I get a 16:01:02  [SELECT - 0 row(s), 0.000 secs]  [Error Code: 6502, SQL State: 65000]  ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1


Is this the right approch to this or is there a better way to be able to get distinct rows from
a table that has NClobs .
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros