json Oracle APEX Rest API主详细信息阵列

0yycz8jy  于 2023-11-20  发布在  Oracle
关注(0)|答案(1)|浏览(186)

我写了下面的查询,在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;

字符串


的数据

相关问题