Last active
October 4, 2017 17:10
-
-
Save informz/940c42a521d18c67a598cfd8564697d6 to your computer and use it in GitHub Desktop.
rest_on_oracle
This file contains 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_url varchar2(100) := 'http://datamaker-stage.aoa.inbcu.com/data-maker/health'; | |
l_req utl_http.req; | |
l_result utl_http.resp; | |
l_data varchar2(4000); | |
l_clob clob; | |
begin | |
dbms_lob.createtemporary(l_clob,true); | |
l_req := utl_http.begin_request(l_url); | |
l_result := utl_http.get_response(l_req); | |
begin | |
loop | |
utl_http.read_text(l_result, l_data, 2000); | |
dbms_lob.writeappend(l_clob,length(l_data),l_data); | |
dbms_output.put_line (l_data); | |
end loop; | |
exception | |
when utl_http.end_of_body then | |
utl_http.end_response(l_result); | |
end; | |
insert into data_maker.lake_config values (sys_guid(), l_clob); | |
commit; | |
dbms_lob.freetemporary(l_clob); | |
end; | |
create table lake_config | |
(id VARCHAR2(32), | |
json_doc CLOB | |
CONSTRAINT ensure_json CHECK (json_doc is JSON) | |
); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment