Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Group by function with CLOB fields in Select statement

700314Nov 8 2011 — edited Nov 8 2011
I have the following sql trying to query our database. Removing the Clob field (a.description) I am successful. But I need the Clob field (a.description). Here is my current sql
select  a.id_number, a.id_owner,  MAX (n.next_action_required)
            KEEP (DENSE_RANK LAST ORDER BY n.modified_date),
         MAX (n.modified_date) KEEP (DENSE_RANK LAST ORDER BY n.modified_date) 
from table1 a, table2 n
where a.id_number = n.id_number
group by a.id_number, a.id_owner
I tried the following which works sometimes but not always because the Clob field (a.description)'s length varies; anywhere from 10 characters up to 12,000 characters. I get some blanks with the following and some where text is cut off. I may not be writing the dbms_lob.substr function correct.
select  a.id_number, a.id_owner,  MAX (n.next_action_required)
            KEEP (DENSE_RANK LAST ORDER BY n.modified_date),
         MAX (n.modified_date) KEEP (DENSE_RANK LAST ORDER BY n.modified_date) , DBMS_LOB.SUBSTR (a.description, 8001, 10000)
from table1 a, table2 n
where a.id_number = n.id_number
group by a.id_number, a.id_owner, DBMS_LOB.SUBSTR (a.description, 8001, 10000)
Please help. Thank you,
This post has been answered by Etbin on Nov 8 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 6 2011
Added on Nov 8 2011
7 comments
6,840 views