Dealing with newline, n or even r in PL/SQL

In my PL/SQL procedure I had to add a text including newline (n in
java, ascii #10) in a text to be read by a java application. Tried with
the code

l_text := 'hellonworld';

This did not work, the n character behaves clearly different in PL/SQL than
in Java and only wrote ‘n’, probably the same as writing a String in
Java using \n. To add the newline character, I had to use chr(10),
that worked.

l_text := 'hello' || chr(10) || 'world';

I guess the same goes for newline-carriage return as well, in Java nr in PL/SQL writes char(10) || chr(13).

Leave a Reply

Your email address will not be published. Required fields are marked *