Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Пример работы с подсказками DaData на PL/SQL (Oracle)
http_req utl_http.req;
http_resp utl_http.resp;
query varchar2(32767);
query_raw RAW(512);
query := '{ "query": "7719402047", "count": 1 }';
query := convert(query, 'UTF8');
http_req := utl_http.begin_request('', 'POST', 'HTTP/1.1');
utl_http.set_header(http_req, 'Content-Type', 'application/json');
utl_http.set_header(http_req, 'Accept', 'application/xml');
utl_http.set_header(http_req, 'Authorization', 'Token API_KEY');
utl_http.set_header(http_req, 'Content-Length', lengthb(query));
query_raw := utl_raw.cast_to_raw(query);
utl_http.write_raw(http_req, query_raw);
http_resp := utl_http.get_response(http_req);
utl_http.set_body_charset(http_resp, 'UTF-8');
dbms_output.put_line('HTTP response status code: ' || http_resp.status_code);
dbms_output.put_line('HTTP response reason: ' || http_resp.reason_phrase);
utl_http.read_text(http_resp, query);
dbms_output.put_line('HTTP utl_http.read_text: ' || query);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment