Oracle 11g: keeping "new line" / "line breaks" in a varchar2(4000) column?

LEGEND ,
Apr 25, 2018 Apr 25, 2018

Copy link to clipboard

Copied

Hello, all,

What is the best way to preserve line breaks from a <textarea> when inserting into an Oracle varchar2(4000) column?

I'm creating a comments section for a blog, and want to keep the input as the user entered it.

This is being processed in ColdFusion 10/11.

V/r,

^ _ ^

CORRECTION:  Apparently, the line breaks are being kept, just fine, when I "view source" the page.  So, this is a formatting-after-get issue, not an Oracle issue.  Nevermind. 

TOPICS
Database access

Views

476

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

LEGEND , Apr 25, 2018 Apr 25, 2018
Fixed it.  Not the best solution, but..<div><p>#REreplaceNoCase(comment_text,"[\r|\n|#chr(13)#|#chr(10)#]","</p><p>","all")#</p></div>Keeps formatting, although the space between lines is larger than I'd like.V/r,^ _ ^

Likes

Translate

Translate
LEGEND ,
Apr 25, 2018 Apr 25, 2018

Copy link to clipboard

Copied

LATEST

Fixed it.  Not the best solution, but..

<div>

<p>#REreplaceNoCase(comment_text,"[\r|\n|#chr(13)#|#chr(10)#]","</p><p>","all")#</p>

</div>

Keeps formatting, although the space between lines is larger than I'd like.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines