Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • How To Resolve Stranded DBA_2PC_PENDING Entries ID 401302.1 (Very Good prooven) Oracle
  • create database link syntax Oracle
  • ENQ: KO – FAST OBJECT CHECKPOINT tips Oracle
  • CTAS with LONG Column for 9i and higher Oracle
  • JSON/XML Types in Oracle Oracle
  • adding new line after specific pattern using sed Linux/Unix
  • tar and untar a dolder with all its subfolder. Linux/Unix
  • online_bkup.sql Oracle
  • grep multuple patterns Linux/Unix
  • Find all users who have DML privileges Oracle
  • Drop all SPM baselines for SQL handle Oracle
  • fkwoind.sql fkwoindex.sql Oracle
  • DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY & SEMAPHORE SEGMENTS Oracle
  • Debugging Shell FIles Linux/Unix
  • fuser to check who is using diretory Linux/Unix

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

  • plan10g.sql good1 Oracle
  • Locally Managed Tablespace and Dictionary managed tablespace (LMT-DMT) Oracle
  • plan10g.sql Oracle
  • ORACLE_SID in sqlplus Oracle
  • ORA-8031 issue and solution if it is occuring due to truncate. Oracle
  • compile_inv.sql 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
  • Wait time tuning research Oracle
  • currwait.sql Oracle
  • good linux notes Linux/Unix
  • How to Use DBMS_STATS to Move Statistics to a Different Database Oracle
  • How to calculate PROCESSES parameter Oracle
  • DBMS_STATS Metalinks Notes Oracle
  • Optimizer SORT Operations Oracle
  • Parallel DML Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme