have table with two columns with datatypes as number and
varchar and the values in
A column like 1,2,3 AND B column values like a,b,c.
now need to display data in a single column as 1,a,2,b,3,c.

Answer Posted / prativa mishra

select rtrim(xmlagg(xmlelement("c",A||' ,'||B||',')).extract('//text()'),',') single_column
from table_name

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What packages(if any) has oracle provided for use by developers?

5033


Can I create table without primary key?

531


how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba

773


How do you use join?

524


What is function and procedure?

567






can sql servers linked to other servers like oracle? : Sql dba

552


Is a foreign key always unique?

534


What is tuple in sql?

545


Which is faster subquery or join?

660


what are the advantages of sql ? : Sql dba

550


What are stored procedures used for?

537


Does execute immediate commit?

700


How can I get the number of records affected by a stored procedure?

577


What is left join in postgresql?

540


Explain sql data types?

629