listagg Questions

2

I have to work on an oracle DB server with the version Oracle Database 12c Release 12.1.0.1.0 - 64bit Production. Therefore I cannot use ON OVERFLOW ... when using the LISTAGG function. To overcome...
Heder asked 19/7, 2021 at 9:0

2

Solved

My query returns many (thousands of) rows. Column l has certain value for very small amount of rows (up to 10). For each such row I want to output aggregated comma-separated values of very short (u...
Sennacherib asked 9/2, 2021 at 21:37

1

The following procedure compiles successfully on ctrll + S (shows VALID) but on execution throws the error : Invalid character error while executing this procedure on SQL DEVELOPER. I don't see any...

24

I am trying to use the LISTAGG function in Oracle. I would like to get only the distinct values for that column. Is there a way in which I can get only the distinct values without creating a functi...
Doormat asked 16/7, 2012 at 19:4

2

Solved

I'm using redshift and would like to create a comma separated list of columns. I'm trying to grab the column names from information schema using listagg: SELECT listagg(column_name,',') within gr...
Customary asked 22/4, 2016 at 1:55

1

Solved

Suppose you have columns ID | A | B | C 1 | 3 | 1 | 2 2 | 5 | 9 | 1 3 | 1 | 2 | 3 and you want the columns concatenated such that the end result would look like ID | ABC_value_DESC | ABC_value...
Salmonberry asked 26/4, 2019 at 10:58

2

Solved

I have to replace the Oracle driver with the newest PostgreSQL. PostgreSQL doesn't know the function LISTAGG. I have to concat values by comma separated. What's the equivalent for the Oracle's func...
Mineral asked 10/4, 2015 at 9:11

3

Solved

Here is a simple Oracle table: +-----------+---------+ | food | person | +-----------+---------+ | pizza | Adam | | pizza | Bob | | pizza | Charles | | ice cream | Donald | | hamburger | Emma | | ...
Ardehs asked 15/2, 2018 at 2:37

3

Solved

This is my first time working with the LISTAGG function and I'm confused. I can select the data easily enough, but the characters of the USERS column all have spaces in between them, and when tryin...
Sillabub asked 2/3, 2015 at 14:39

2

I'm trying to limit one of my columns in my SQL query that uses LISTAGG to only group the first 3 rows into a single column. For instance: Table ----- Name Orders --------------- Joe Joe_Order1 ...
Philippe asked 30/5, 2017 at 13:56

4

I am new to using Listagg. The following script works in respect of it gives me a list of values but, the list duplicates the values. Is it possible to use Listagg to return only a unique list of ...
Turnpike asked 9/2, 2016 at 17:51

1

If I do SELECT LISTAGG( COLUMN_VALUE ) WITHIN GROUP ( ORDER BY NULL ) AS OrderByNULL, LISTAGG( COLUMN_VALUE ) WITHIN GROUP ( ORDER BY 1 ) AS OrderByCONST, LISTAGG( COLUMN_VALUE ) WITHIN GROUP ( ...
Tarragona asked 2/3, 2016 at 12:34

2

I have a problem regarding SQL query , it can be done in "plain" SQL, but as I am sure that I need to use some group concatenation (can't use MySQL) so second option is ORACLE dialect as there will...
Apsis asked 30/6, 2016 at 15:48

1

Solved

I'm trying to get the COLLECT function to work for me. I'm using 10g and therefore found that LISTAGG and WM_CONCAT will not work (invalid identifier errors). The data I have is for example as foll...
Amniocentesis asked 24/5, 2016 at 20:44

1

Solved

Created one view within which one field(of 6) is a concatenation of two fields from the source table. Created a second view that uses listagg to potentially combine the results of the concate...
Prop asked 21/4, 2015 at 15:4
1

© 2022 - 2024 — McMap. All rights reserved.