Vamsi Pavan’s Place

When curiousity outbursts …..

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

January 8th, 2009 · No Comments · Pl/SQL, Programming

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 := 'hello\nworld';

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 \n\r in PL/SQL writes char(10) || chr(13).

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

Tags:

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment