gaurav
gaurav

Reputation: 345

New Line while inserting into VARCHAR2 column

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 .

Upvotes: 9

Views: 22048

Answers (1)

Rajesh Chamarthi
Rajesh Chamarthi

Reputation: 18808

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...

Upvotes: 16

Related Questions