D
D
Dmitry Volkhontsev2016-10-27 21:26:00
Oracle
Dmitry Volkhontsev, 2016-10-27 21:26:00

Is it possible to output data in json format in BD Oracle 10g?

Good day.
Can you please tell me if it is possible to make a similar request in Oracle bd 10g?

SELECT menu_main.id,
    menu_main.name,
    ( SELECT array_to_json(array_agg(row_to_json(child.*))) AS array_to_json
           FROM ( SELECT menu_second.type,
                    menu_second.name,
                    (menu_main.link::text || '-'::text) || menu_second.link::text AS link
                   FROM menu_second
                  WHERE menu_second.mainmenu = menu_main.id
                  ORDER BY menu_second.orders) child) AS items
   FROM menu_main;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danila, 2016-10-28
@DarkDD

1) You can do it yourself using crutches through xml:
Oracle Goodies for XML and JSON
2) You can use the ready-made package pljson:
github
which is used like this:

declare 
  ret json;
begin
  ret := json_dyn.executeObject('select * from tab');
  ret.print;
end;
/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question