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 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
This was first published in December 2006
Join the conversationComment
Share
Comments
Results
Contribute to the conversation