Search code examples
oraclenewline

How to enter newline character in Oracle?


select col1, col2
    into name1, name2
    from table1
    where col1=col;

        m_sub := 'Subject ';
    m_msg := 'Hello '||name||' ,'||/n||/n||'Your order has been placed.';

Error(34,33): PLS-00103: Encountered the symbol "/" when expecting one of the following: ( - + case mod new null avg count current max min prior sql stddev sum variance execute forall merge time timestamp interval date pipe


Solution

  • Chr(Number) should work for you.

    select 'Hello' || chr(10) ||' world' from dual
    

    Remember different platforms expect different new line characters:

    • CHR(10) => LF, line feed (unix)
    • CHR(13) => CR, carriage return (windows, together with LF)