Nested JSON

Padmocho-Oracle

    Hi,

     

    What is wrong with the following code?:

     

    DECLARE

      l_cursor SYS_REFCURSOR;

    BEGIN

        OPEN l_cursor FOR

    select d.country,

           CURSOR(select e.resource_email

                  from pa_source e

                  where e.resource_email = d.email )

    from aria d;

     

      APEX_JSON.initialize_clob_output;

      APEX_JSON.open_object;

      APEX_JSON.write('name','Level 1');

      APEX_JSON.write('colorByPoint','true');

      APEX_JSON.write('data', l_cursor);

      APEX_JSON.close_object;

     

    DBMS_OUTPUT.put_line(APEX_JSON.get_clob_output);

      APEX_JSON.free_output;

    END;

     

    It just freezes for a long time and then throws an error:

    ORA-06502: PL/SQL: numeric or value error

     

    Note - I'm trying to achieve the same as in nesting of JSON example provided here: https://oracle-base.com/articles/misc/apex_json-package-generate-and-parse-json-documents-in-oracle