Re: How to add a new line inside the columns

From: Deepak Mathur <deepak.mathur_at_oracle.com>
Date: 1 Aug 2001 02:43:14 -0700
Message-ID: <cc8172b4.0108010143.53e3ced0_at_posting.google.com>


Ok,

Here's a quick one..

SQL> select * from temp1;

      SRNO NAME

---------- ----------------------------------------
         1 BILL GATES
         2 LARRY ELLISON

SQL> select srno,
substr(name,1,instr(name,' ')-1)||chr(10) ||substr(name,instr(name,' '),length(name)) from temp1;

      SRNO NAME

---------- ---------------------
         1 BILL
            GATES

         2 LARRY
            ELLISON


Note :
1. CHR(10) returns a newline
2. INSTR function returns the position of the character you are searching for (in this case ' ' ...space as a name seperator)

HTH,
Deepak

> In one column, I want to insert a new line to it, how would I do it?
>
> Ex:
> Table
> Column1 (ID) Column2 (Name)
> ------------ ---------------
> 001 First Last
>
> How do I change it to
>
> Column1 (ID) Column2 (Name)
> ------------ ---------------
> 001 First
> Last
Received on Wed Aug 01 2001 - 11:43:14 CEST

Original text of this message