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!

Concatenation of strings of more than 4000 characters

SleepDeprivedInSeattleAug 2 2011 — edited Aug 4 2011
I am running Oracle 10.2 database.
I have a table which has about 30 rows of CHAR data (each 235 characters long). I need to concatenate these together. However, when I do, I end up with a string 4270 characters long which is too long for a VARCHAR2 field.

I tried using the "Ask Tom" solution to use the stragg function (http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:2196162600402) , which I converted from VARCHAR2 to CLOB. This works EXCEPT: The resulting data is random. Even if I specify a sort order to the data coming in (there is an internal sequence number), the 30 rows are scattered throughout the CLOB. If I use the same function in its initial form (VARCHAR2) on a rowset less than 4000 characters, it works correctly.

So...

How do I get 30 rows of character data concatenated together into one field (I really don't care if it is a CLOB or whatever).

Table looks something like this (the 1st 3 fields indicate the sequence):

EVENTID varchar(10);
PAGE_NO number;
ENTRY_NO number;
REMARK_DATA CHAR(234);

Does anyone have another solution?

Thank you in advance.

--Seattle
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 1 2011
Added on Aug 2 2011
11 comments
12,158 views