Created
April 10, 2016 09:00
-
-
Save velppa/eb3139ee601ee1ad31daade863335a9c to your computer and use it in GitHub Desktop.
Generating JSON from Oracle Database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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