Home > Mobile >  Oracle Apex - SQL decode colon delimited list of values
Oracle Apex - SQL decode colon delimited list of values

Time:11-23

I'm not sure how best to go about this. Is it possible to decode each value in a colon delimited list? Example:

emp
---
1:2:3:4

decode(emp, ('1','2','3','4'), ('a','b','c','d')) emp

result:

emp
------
a:b:c:d

But obviously this does not work. What would be the best course of action to achieve this?

CodePudding user response:

Try with

    SELECT LISTAGG(ENAME, ', ')
     WITHIN GROUP (ORDER BY hiredate, ENAME) "Emp_list",
   MIN(hiredate) "Earliest" FROM emp WHERE deptno = 30;

enter image description here

You can pick any delimiter.

enter image description here

  • Related