Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

send json as clob to aop

ReemaPuriJun 13 2019 — edited Jun 13 2019

hi ,

example 1 created :-

i have created a simple example in which we call plsql function which is  send to aop (APEX OFFICE PRINTER) by dynamic action

https://apex.oracle.com/pls/apex/f?p=14191:4:101713341871978:::::

function created is :-

create or replace FUNCTION GET_AOP_SQL RETURN CLOB IS

      V_SQL CLOB;

   BEGIN

      V_SQL := 'SELECT

       CURSOR (SELECT

                      CURSOR (SELECT id               AS "id",

                                     ROLE                  AS "role"

                                    

                              FROM   test

                              WHERE  id=1

                ) AS "test"

               FROM   DUAL ) AS "data"

FROM   DUAL';

      RETURN V_SQL;

   EXCEPTION

      WHEN OTHERS THEN

         --Lookup Failed, Return Null

         RETURN NULL;

   END GET_AOP_SQL;

example 2 required :-

Requirement :-

i have generated json by below plsql anonmymous block and store in a clob "clob_test"  table ,is someone know to pass json as clob to AOP  not by the way i have done above  by calling plsql ?

DECLARE

  l_cursor SYS_REFCURSOR;

BEGIN

 

  OPEN l_cursor FOR

    SELECT id  AS "id",

         ROLE       AS "role"

       FROM   test

       WHERE  id = 1;

  APEX_JSON.initialize_clob_output;

  APEX_JSON.open_object;

  APEX_JSON.write('test', l_cursor);

  APEX_JSON.close_object;

  DBMS_OUTPUT.put_line(APEX_JSON.get_clob_output);

  insert into clob_test values (APEX_JSON.get_clob_output);

  APEX_JSON.free_output;

END;

select * from clob_test where id=1

json generated :-

{ "test":[ { "id":1 ,"role":"ADMIN" } ] } 
Comments
Post Details
Added on Jun 13 2019
1 comment
443 views