Dave Novelli
Dave Novelli

Reputation: 2184

Losing newline characters when saving Java string to Oracle CLOB field

I'm building a java string and adding newline characters ("\n") where I want to indicate the end of a record. I was storing this string in oracle in a VARCHAR2 field and everything was working just fine until the data I was storing grew too large for such a field. I now am trying to save the records in a CLOB, but when I retrieve the records the newline is missing.

How can I make sure that when I retrieve the data the newlines are still there?

I'd love to add code examples, but I'm working with an API that abstracts the database layer so I'm not exactly certain what it's doing. All I know is it worked when it was saving as a VARCHAR2 but as a CLOB it's gone.

Upvotes: 3

Views: 5937

Answers (1)

jberg
jberg

Reputation: 4818

Here is a link to a thread addressing the same issue:

Are escape sequences preserved in CLOB??

There is no reason the CLOBs should be losing your escape characters as long as you are using the correct encodings the entire time AFAIK.

Upvotes: 1

Related Questions