Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

convert multiline column one line column in oracle

I have a table that contains three columns but one of them contains multiline text.I want to create another table from that row but adress column should be one line.

My table is Student

Table: Student

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

id  |  name  | address    
 1  |  John  | London Street`               
               Capital square Number:3`

What I want to do is to create another table like that(Address column should be one line)

id | name | address 
1  | John | London Street Capital square Number:3

My query is like that:

create table StudentTest as (select * from Student where id = 1)

Do you have any idea for PL/SQL?

>Solution :

A simple replace should do:

Source:

SQL> select * From test;

        ID NAME ADDRESS
---------- ---- -------------------------------------
         1 John London Street
                Capital square Number:3

Query:

SQL> select id, name, replace(address, chr(10), ' ') address
  2  from test;

        ID NAME ADDRESS
---------- ---- -------------------------------------
         1 John London Street Capital square Number:3

SQL>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading