Skip to content
Advertisement

Tag: listagg

Returning multiple identical rows in LISTAGG query

I’m using Oracle, and want to connect two tables into one select statement (for a report), and we’re required to concatenate some of the data from one table into a single row – for which I’m expecting to use LISTAGG. Simplified version of the problem: ACCOUNTS table: InitialDate AccountNumber Balance 01/01/1980 11111 20 02/01/1980 22222 30 03/01/1980 33333 40 04/01/1980

How to use listagg properly with case statements

I am trying to use listagg but I’m getting the wrong output. Normally, I would use each case statement separately, but then how would I use listagg? Table A: Table B: Desired Output: My attempted (wrong) code: Answer Here’s one option, which uses multiple self-joins. lines #1 – 14 represent your sample data anima CTE is here to simplify code;

How to use Replace/Substitution function in PL SQL

I’ve a doubt regarding replacing / substituting values in PLSQL. I’ve used listagg to segregate n number of values with each and every value being splitted by comma delimiter. For instance when executing the above query it returns 7digit alpha numeric values. For example ABCD123,EFGH456,IJKL789 After storing the above values in a variable. When trying to replace the comma (,)

Advertisement