我写了下面的查询,在SQL workshop中运行良好。我也验证了JSON格式是正确的。但是,当我创建GET API时,它给出了一个错误:
SELECT 'application/json' as content_type, JSON_OBJECT (
KEY 'departments' VALUE (
SELECT JSON_ARRAYAGG(
JSON_OBJECT (
KEY 'department_name' VALUE d.DEPARTMENT_NAME,
KEY 'department_no' VALUE d.DEPARTMENT_ID,
KEY 'employees' VALUE (
SELECT JSON_ARRAYAGG (
JSON_OBJECT(
KEY 'employee_number' VALUE e.EMPLOYEE_ID,
KEY 'employee_name' VALUE e.FIRST_NAME
)
)
FROM OEHR_EMPLOYEES e
WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID
)
)
)
FROM OEHR_DEPARTMENTS d
where d.DEPARTMENT_ID in (10,20,30)
)
) AS departments
FROM dual;
字符串
的数据
1条答案
按热度按时间0tdrvxhp1#
删除结尾处的分号。