Skip to content

Instantly share code, notes, and snippets.

@velppa
Created April 10, 2016 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velppa/eb3139ee601ee1ad31daade863335a9c to your computer and use it in GitHub Desktop.
Save velppa/eb3139ee601ee1ad31daade863335a9c to your computer and use it in GitHub Desktop.
Generating JSON from Oracle Database
declare
l_xml xmltype;
l_json clob;
begin
apex_json.initialize_clob_output;
select XMLElement("obj",
XMLForest(
XMLForest(
12345 as "id"
) as "issue",
XMLForest(
'SOME TEMPLATE' as "name"
) as "template"
))
into l_xml
from dual;
apex_json.write(l_xml);
l_json := apex_json.get_clob_output;
apex_json.free_output;
dbms_output.put_line(l_json);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment