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!

How to properly use CrLf characters in PL/SQL Function?

Blue BirdMar 29 2018 — edited Mar 29 2018

I have PL/SQL function something like this:

Declare

  Qry Varchar2(4000);

  Crlf Varchar2(2) := Chr(10) || Chr(13);

--  Crlf Varchar2(1) := Chr(10); Ok too

--  Crlf Varchar2(1) := Chr(13); Ok too

Begin

  Qry := 'Select  ' || Crlf ||

         '  EName ' || Crlf ||

         ' ,DeptNo' || Crlf ||

         'From Emp;';

  Return Qry;

End;

which is then used for example in APEX as source for PL/SQL Function Body returning SQL Query.

I would like to know if is necessary to use for CrLf character both ASCII codes (10 and 13) or just one of them? Currently look like this approach work in all 3 cases, but maybe somewhere else this could cause hard to find bug.

What is your good practice / suggestions about using such characters if you use such kind of visual formatting for SQL? Thanks for you opinions and answers.

BB

This post has been answered by Paulzip on Mar 29 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 26 2018
Added on Mar 29 2018
20 comments
10,848 views