utl_http.HTTP_CONTINUE例子



我想使用"utl_http.HTTP_CONTINUE"在我的pl SQL代码。但是我找不到任何例子来使用它。谁能告诉我如何使用"utl_http.HTTP_CONTINUE"在调用rest API从pl SQL方面?

oracle文档:

HTTP_CONTINUE

DECLARE
data  VARCHAR2(1024) := '...';
req   utl_http.req;
resp  utl_http.resp;
BEGIN

req := utl_http.begin_request('http://www.acme.com/receiver', 'POST');
utl_http.set_header(req, 'Content-Length', length(data));
-- Ask HTTP server to return "100 Continue" response
utl_http.set_header(req, 'Expect', '100-continue');
resp := utl_http.get_response(req, TRUE);

-- Check for and dispose "100 Continue" response
IF (resp.status_code <> 100) THEN
utl_http.end_response(resp);
raise_application_error(20000, 'Request rejected');
END IF;
utl_http.end_response(resp);

-- Now, send the request body
utl_http.write_text(req, data);

-- Get the regular response
resp := utl_http.get_response(req);
utl_http.read_text(resp, data);

utl_http.end_response(resp);

END;

相关内容

  • 没有找到相关文章

最新更新