9

I have a requirement where i need to prepare data for email ,So i populate
data into column of table having VARCHAR2(4000) as definition, Now what i want, is to insert it into new line wherever i want to .

 begin
 v_email := v_email ||--new line--??;
 end;

Suppose i am preparing email text 'List of all blocked transaction id ' ..in one line 1)transaction_id ....in another lin e 2)transaction_id .....in another line.

I am using oracle as rdbms .

1 Answer 1

16

You could use the ASCII code and the CHR function to do this.

Here's the entire list. http://www.asciitable.com/

SQL> conn rc/rc@orcl102
Connected.
SQL> set serveroutput on;
SQL> begin
  2    dbms_output.put_line('Hello..' || chr(10) || 'how are you...');
  3  end;
  4  /
Hello..
how are you...
2
  • 3
    You might also consider using 'Hello..' || chr(13) || chr(10) || 'how are you'; if you want dos/windows style line ending (CR+LF), instead of unix style (LF). You can use any combination as long as whole emaile message uses the same line ending style.
    – SWilk
    Nov 7, 2011 at 13:15
  • @Rajesh :Sorry Thanks to you too,dint see your name in solution :)
    – gaurav
    Nov 7, 2011 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.