Oracle中是否有ARRAY_AGG PostgreSQL函数的类似物?

时间:2019-04-01 06:59:43

标签: sql oracle

如何在Oracle中返回类似于PostgreSQL的ARRAY_AGG函数的数组?

SELECT
    ARRAY_AGG(EMAIL)
FROM
    EMPLOYEES
WHERE
    EMAIL IS NOT NULL
AND
    ORGANIZATION_ID IN (27623,27734)

1 个答案:

答案 0 :(得分:1)

使用LISTAGG()

SELECT
    LISTAGG(EMAIL) WITHIN GROUP (ORDER BY EMAIL) as email
FROM
    EMPLOYEES
WHERE
    EMAIL IS NOT NULL
AND
    ORGANIZATION_ID IN (27623,27734)