I'm trying to sort a column type asc as well as desc. I'm able to sort the clob column desc but not able to sort...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
it asc. Can you please help me out? Please find below the sample query that I used.
select * from TAbleA A where A.col1='XXX' order by dbms_lob.substr(clobCol, 1, dbms_lob.getlength(clobCol)) desc
Here clobcol is the clob column with which I wanted to sort.
In 9i release 2, the parameters in dbms_lob.substr is ordered differently then in a substr function. In substr the parameter order is: substr (string, position, length). In dbms_lob.substr the parameter order is: dbms_lob.substr (lob_locator, length, position). Therefore, your SQL will sort correctly if your function looks like this:
dbms_lob.substr(clobCol, dbms_lob.getlength(clobCol), 1) asc
Dig Deeper on Using Oracle PL-SQL
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.