Oracle APEX Rest API 主详细信息数组

Oracle APEX Rest API master detail array

提问人:Mohammad Ubaid 提问时间:11/1/2023 最后编辑:Brian Tompsett - 汤莱恩Mohammad Ubaid 更新时间:11/2/2023 访问量:29

问:

我在下面写了查询,它在 SQL 研讨会中工作正常。我还验证了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;

enter image description here

JSON REST oracle-apex-22

评论


答:

0赞 Norman Aberin 11/2/2023 #1

删除末尾的分号。