Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • TRUNCATE table and disabling referential constraints. Oracle
  • sql_doing_fts.sql Oracle
  • How to specify 2 arch location to avoid any kind of DB hanging. Oracle
  • Database logon trigger issue Oracle
  • good linux notes Linux/Unix
  • Parallel DML Oracle
  • oracle 11g RAC on vmware Oracle
  • My FTP Job Scheduling for www.pvmehta.com PHP/MYSQL/Wordpress
  • Drop specific SQL plan baseline – spm Oracle
  • Resolving RMAN Hung Jobs Oracle
  • purge_trc.sh Linux/Unix
  • import-export with multiple files Oracle
  • How to stop OCSSD Daemon Oracle
  • create user with unlimited quota Oracle
  • Jai Shree Ram 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

  • Sending SQLPLUS output in HTML format Oracle
  • How to Modify the statistics collection by MMON for AWR repository Oracle
  • executing Function from SQLPLUS prompt Oracle
  • SCRIPT TO LIST RECURSIVE DEPENDENCY BETWEEN OBJECTS UTLDTREE.sql Oracle
  • dbms_job.submit example Oracle
  • tblwopk.sql tablewopk.sql 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 (392)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • 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
  • MYSQL and Oracle Comparison for Oracle DBA24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • initUOCIOTTO.ora Oracle
  • chk_space_SID.ksh Linux/Unix
  • Renaming Oracle Instance Name Oracle
  • TRUNCATE Privs Oracle
  • How to specify 2 arch location to avoid any kind of DB hanging. Oracle
  • Library cahe Latches and internal explaination Oracle
  • SQL Server: How to see historical transactions SQL Server
  • tar and untar a dolder with all its subfolder. Linux/Unix

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme