I am setting the timeout for 2 seconds but the code is running for a minute and is then going to when others
instead of when UTL_HTTP.transer_timeout
.
DECLARE
request UTL_HTTP.REQ;
response UTL_HTTP.RESP;
n NUMBER;
buff VARCHAR2 (4000);
clob_buff CLOB;
BEGIN
UTL_HTTP.SET_RESPONSE_ERROR_CHECK (FALSE);
UTL_HTTP.set_transfer_timeout (2);
request := UTL_HTTP.BEGIN_REQUEST ('www.google.com:81', 'GET');
UTL_HTTP.SET_HEADER (request, 'User-Agent', 'Mozilla/4.0');
response := UTL_HTTP.GET_RESPONSE (request);
DBMS_OUTPUT.PUT_LINE (
'HTTP response status code: ' || response.status_code);
EXCEPTION
WHEN UTL_HTTP.transfer_timeout
THEN
DBMS_OUTPUT.put_line ('Timeout');
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Exception in others :' || SQLERRM);
END;
Why isn't the timeout being caught?