Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Create type and Grant on it. Oracle
  • find_err.sql for finding errors from dba_errors. Oracle
  • How to find where datafile is created dbf_info.sql Oracle
  • Mutating Table Error while using database trigger Oracle
  • Good notes for shared pool Oracle
  • Resolving RMAN Hung Jobs Oracle
  • RAC 11g with vmware Oracle
  • Backup and Recovery Scenarios Oracle
  • oracle Dba site Oracle
  • How to find Unix server conguraiton including Server Model number and underlying disk sub-system ( On Solaris) Linux/Unix
  • mutex in Oracle 10.2.0.2 or Oracle 10g Oracle
  • Oracle vs MYSQL Architecture differences (For DBAs) MYSQL
  • Database logon trigger issue Oracle
  • Python class import from different folders Python/PySpark
  • Global Unique Identifier Generation in Oracle 9.2 SYS_GUID() 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

  • Nice notes on wait events Oracle
  • Reclaim temp tablespace for oracle 8, 8i Oracle
  • ORACLE_SID in sqlplus Oracle
  • SQL Tracker by SID sqltrackerbysid.sql Oracle
  • Physical Standby switchover with session active Oracle
  • Very clear article about oracle dataguard Oracle

Leave a Reply Cancel reply

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

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • useful dg links Oracle
  • setting prompt display with .profile Linux/Unix
  • How to start CRS manually Oracle
  • Find Stale DR Physical Standby Oracle
  • CPU speed on Linux Linux/Unix
  • avail.sh ( find filesystem spae usage) Linux/Unix
  • How to find pinned objects from shared pool. (pinned via dbms_shared_pool.keep) Oracle
  • find the files that are 1 day old. Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme