Highlighted

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

LEGEND ,
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. 

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,

^ _ ^

TOPICS
Database access

Views

394

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

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

LEGEND ,
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. 

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,

^ _ ^

TOPICS
Database access

Views

395

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
Apr 25, 2018 0
LEGEND ,
Apr 25, 2018

Copy link to clipboard

Copied

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
Reply
Loading...
Apr 25, 2018 0