I am trying to send data via an HTTP post request from Oracle using UTL_HTTP. The code is like this:
REQ := UTL_HTTP.BEGIN_REQUEST(URL,'POST','HTTP/1.1')
UTL_HTTP.SET_HEADER(REQ,'USER-AGENT','MOZILLA/4.0')
UTL_HTTP.SET_HEADER(REQ,'CONENT-LENGT',LENGTH(V_BODY)
UTL_HTTP.SET_HEADER(REQ,'CONTENT-TYPE','APPLICATION/JSON')
UTL_HTTP.SET_HEADER(REQ,'SDATE','01/06/2021')
UTL_HTTP.WRITE_RAW(REQ,UTL_RAW.CAST_TO_RAW(V_BODY)
RES := UTL_HTTP.GET_RESPONSE(REQ);
UTL_HTTP.READ_TEXT(RES,BUFFER);
Inside the V_BODY parameter is a clob containing JSON and this json I select from database then put in a clob. Now the request is working fine when the selected data records about 50 to 100 request, but I need to send one million records, and when I trying sending such request it fails when putting the clob as a parameter. It like the http request does not allow me to send such huge data. What is the best way to handle this issue or is there a way to send it in smaller chunks?
You can use a header to tell the target that you are going to send the data in chunks.
Then you send the data in batches using what carving up mechanism you like
etc etc.
If that doesn't work, it may be an issue with the receiver because not all web servers will happily accept chunked requests.