Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Sequence Resetting Oracle
  • Move WordPress site from one hosting service to other. PHP/MYSQL/Wordpress
  • v$event_name Oracle
  • How to find password change date for user Oracle
  • Formatter Explain plan Output 1 Oracle
  • find_pk.sql /* Find Primary Key */ Oracle
  • Implementing Listener Security Oracle
  • How to sort list of files on basis of their sizes. Linux/Unix
  • Linux CPU info. Linux/Unix
  • Parallel DML Oracle
  • replace alphabets using sed Linux/Unix
  • Index Range Scan Oracle
  • Good Site for Oracle Internals Oracle
  • Find total file sizes Linux/Unix
  • dbms_job.submit example 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

  • Order by with ROWNUM Oracle
  • Oracle Internal Good Websites 1 Oracle
  • DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY & SEMAPHORE SEGMENTS Oracle
  • Pending Transaction Neighbors Script Oracle
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • Absolute file number and relative file number 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 (392)
  • PHP/MYSQL/Wordpress (10)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • load SPM baseline from cursor cache05-Jun-2025
  • Drop all SPM baselines for SQL handle05-Jun-2025
  • Load SPM baseline from AWR05-Jun-2025
  • Drop specific SQL plan baseline – spm05-Jun-2025
  • 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

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Move WordPress site from one hosting service to other. PHP/MYSQL/Wordpress
  • JSON/XML Types in Oracle Oracle
  • Oracle10g – Using SQLAccess Advisor (DBMS_ADVISOR) with the Automatic Workload Repository Oracle
  • create user with unlimited quota Oracle
  • Histogram information Oracle
  • import-export with multiple files Oracle
  • ext#.sql Oracle
  • export import with parameter file. Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme