Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how can get like this result
table A
col1 col2
--- -----

a A
b B
C C
.. ..
.. ...
.. ...
wants result like for a single column

col1
------
a,b,c,........n of data


and


another is


col1
-------
A B C D ........
a b b d ........

Answers were Sorted based on User's Feedback



how can get like this result table A col1 col2 --- ----- a A b B C C .. .. .. ... ..

Answer / ajit

select wm_concat(col1) col1
from t1;

select wm_concat(col2)||chr(10)||
wm_concat(col1) col1
from t1;

Is This Answer Correct ?    1 Yes 0 No

how can get like this result table A col1 col2 --- ----- a A b B C C .. .. .. ... ..

Answer / suman rana

If you are using Oracle 11g Release 1 and above version,
following queries will work.

SELECT listagg (b, ',') WITHIN GROUP (ORDER BY 1) hh
FROM (SELECT 'A' a, 'a' b FROM DUAL
UNION
SELECT 'B', 'b' FROM DUAL
UNION
SELECT 'C', 'c' FROM DUAL);


WITH qry AS
(SELECT 'A' a, 'a' b FROM DUAL
UNION
SELECT 'B', 'b' FROM DUAL
UNION
SELECT 'C', 'c' FROM DUAL)
SELECT listagg (a, ' ') WITHIN GROUP (ORDER BY 1) FROM qry
UNION ALL
SELECT listagg (b, ' ') WITHIN GROUP (ORDER BY 1) FROM qry;

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Oracle General Interview Questions

How to manage transaction isolation level?

0 Answers  


Explain the use of rows option in exp command.

0 Answers  


How to create a table interactively?

0 Answers  


how to find out largest value in a table

2 Answers  


9)When information has to be stored w.r.t employees and their respective departments, which of the following is the Correct formulation of entries? A)Employee and department would together be represented as an entity. B)This is too less information to decide on entities. C)An employee would be one entity and a department would be another. D)Such a scenario cannot be modelled in RDBMS

2 Answers   Mind Tree,


What is the difference between Delete, Truncate and Drop in Oracle?

0 Answers   MCN Solutions,


Difference between an implicit & an explicit cursor.?

2 Answers  


What is a tns file?

0 Answers  


SELECT * FROM (SELECT TITLE FROM MOVIE ORDER BY RANK DESC) WHERE ROWNUM > 4; when i run the above query .it produces output as NO ROWS SELECTED.why ?plz any one help me

6 Answers   TCS,


How do I use unicode codesets with the weblogic jdriver for oracle driver?

0 Answers  


How do we know whether an index is created on a table ???

2 Answers   TCS,


Does facebook use oracle?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)