Home > Ask the Oracle Database / Applications Experts > Oracle PL/SQL Questions & Answers > Sorting a clob column
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Sorting a clob column

Advice from previous expert, Greg Williams EXPERT RESPONSE FROM: Advice from previous expert, Greg Williams

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 18 December 2006
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


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Oracle PL/SQL
How to concatenate rows into a single CLOB in PL/SQL
Working with substitution variables and using EXECUTE IMMEDIATE in PL/SQL
How to open a ref cursor in a PL/SQL procedure
Converting Long Raw to Blob
Parsing in Oracle
ORA-01422 error when procedure returns more than one row
Definition of force view
ORA-04082: NEW or OLD references not allowed in table level triggers
Execute SQL statement from table in other schema
Script to revoke access from user

Using Oracle PL/SQL
Oracle tutorial library: SearchOracle.com's learning guides
SELECT statement syntax and examples
Oracle PL/SQL tutorial
PL/SQL datatypes in Oracle
Stored procedures in PL/SQL
PL/SQL functions and triggers in Oracle
How to concatenate rows into a single CLOB in PL/SQL
How to open a ref cursor in a PL/SQL procedure
Working with substitution variables and using EXECUTE IMMEDIATE in PL/SQL
Oracle's free SQL Developer adds database migration tool

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
PL/SQL  (SearchOracle.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Oracle White Papers: Fusion Middleware
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts