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!

chr(10) not working?

CodePixieSep 3 2013 — edited Sep 3 2013

Hello -

I am writing a procedure that returns a large (clob) of dynamic sql. 

To make this readable, I am trying to insert carriage returns and/or line feeds into the text, though they are not working.

Basically, I have a large string with '\n' where I want the carriage returns, then trying to run REPLACE (input_string, '\n', chr(10) ) to create the output, but all this does is remove the '\n' part from the string.

I have also tried chr(13) and  chr(13)||chr(10), though to the same effect.

Actually, running the sme as a sql command (in sqldeveloper) does the same:

select  REPLACE ('line 1\nline 2' , '\n', chr(10) ) from dual;

line 1line 2 

or even simply ...

select 'line 1' || chr(10) || 'line 2' from dual;

line 1line 2 

I'm sure this used to work in Oracle - or am I doing something wrong?  I am using exadata - does this affect the syntax?

Many thanks! 

This post has been answered by Ishan on Sep 3 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 1 2013
Added on Sep 3 2013
6 comments
3,589 views