Skip to Main Content

APEX

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!

How to display newline characters as new lines

mmagan-OracleJan 8 2012 — edited Jul 18 2012
Apex 4.1
I have a table with a notes column varchar2(4000). It is filled by a textarea on a form. An example of the contents could be:

This widget specifies AB
This second line says AC

Lets assume that the notes also contain strings that should be escaped when displaying as HTML (it's a bit difficult to post an example in this forum)
In a report, I want this column to display literally as entered, i.e.:
- The second line displays after the first
- Special characters/strings are not interpreted as HTML

I tried this:

select notes from emp
The newlines are never displayed, no matter what the "Display Text As" setting is.

select replace(notes, chr(13) || chr(10), '
') as notes from emp
Display Text as 'Standard Report Column'
This displays the newlines correctly, but does not escape the special characters.
If I do escape the special characters, then obviously the
is also escaped.

select '<pre>'||notes||'</pre>' as notes from emp
This also renders newlines correctly but other tags are (curiously) not displayed.

So I can't really find a solution for what I want. Suggestions?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 15 2012
Added on Jan 8 2012
6 comments
5,396 views