SELECT DISTINCT id, dbms_lob.substr(description,500,1) FROM table;
For this to be useful, you will need to know how long a string in your CLOB has to be to determine distinctness. This example assumes 500 characters will be sufficient.
Personally I would have a column in the table with the clob to hold a hash value that could be used to check for a distinct value in the clob. Maintain the hash column by having a trigger on insert or update of the clob column and use DBMS_CRYPTO.HASH to calculate the hash. I would not use a virtual column because everytime you looked at the data it would have to fire the DBMS_CRYPTO.HASH. By using a trigger and an actual column it would only fire when necessary
Bill
Lead Application Developer
New York State, USA
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.