Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • find_longsql.sql Oracle
  • temp_use.sql diplays usage of temp ts Oracle
  • Exadata Basics Oracle
  • How to Modify the statistics collection by MMON for AWR repository Oracle
  • More info about /proc folder and its relation with processes. Linux/Unix
  • Implementing Listener Security Oracle
  • Jai Shree Ram Oracle
  • Zip and unzip with tar Linux/Unix
  • Important Script Method for tuning Oracle
  • Locally Managed Tablespace and Dictionary managed tablespace (LMT-DMT) Oracle
  • oracle fast start failover best practice Oracle
  • Good link for LIO in Oracle ( Logical IOs) Oracle
  • fuser to check who is using diretory Linux/Unix
  • Adding Datafile on Primary Server and Impact on Standby Server Oracle
  • findobj.sql Oracle

Convert multiple rows to single column

Posted on 13-Sep-202313-Sep-2023 By Admin No Comments on Convert multiple rows to single column

Converting rows to single column:

create table emp ( empno number, empname varchar2(100), deptno number);
insert into emp values( 1, 'emp1', 10);
insert into emp values( 2, 'emp2', 20);
insert into emp values( 3, 'emp3', 30);
insert into emp values( 4, 'emp4', 10);
insert into emp values( 5, 'paresh', 30);
insert into emp values( 6, 'martin', 30);
insert into emp values( 7, 'sri', 10);

select deptno,
rtrim (xmlagg (xmlelement (e, empno || ',')).extract ('//text()'), ',') list_of_empnos
from emp
group by deptno ;

Oracle, SQL scripts

Post navigation

Previous Post: Find all users who have DML privileges
Next Post: Creating never expiring DB user accounts in Oracle

Related Posts

  • Insert cause enqueue locks Oracle
  • Find Multiple levels of object dependencies : depen.sql Oracle
  • Btee and Bitmap Plans in Oracle 9i and higher Oracle
  • Identical Dblink Issue… Oracle
  • Histogram Overview Oracle
  • export import with parameter file. Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • Oracle (388)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (337)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • findinfo.sql (SQL for getting CPU and Active session info)27-May-2025
  • SQL Tracker by SID sqltrackerbysid.sql22-Apr-2025
  • How to connect to Oracle Database with Wallet with Python.21-Mar-2025
  • JSON/XML Types in Oracle18-Mar-2025
  • CPU Core related projections12-Mar-2025
  • Exadata Basics10-Dec-2024
  • Reading config file from other folder inside class24-Sep-2024
  • Python class import from different folders22-Sep-2024
  • Transfer SQL Profiles from One database to other database.05-Sep-2024
  • Load testing on Oracle 19C RAC with HammerDB18-Jan-2024

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Transfer SQL Profiles from One database to other database. Oracle
  • For Perl DBI installation and testing program PHP/MYSQL/Wordpress
  • sql_plan9i.sql Oracle
  • Implementing Listener Security Oracle
  • Shuffle an array PHP/MYSQL/Wordpress
  • 10g RAC: Troubleshooting CRS Root.sh Problems Oracle
  • tblwopk.sql tablewopk.sql Oracle
  • Move WordPress site from one hosting service to other. PHP/MYSQL/Wordpress

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme