title: How to hit a http URL from PL/SQL procedure?
body: <p>Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production</p>
  
  <p>I am creating an Oracle job where I need to hit a procedure for every 30 minutes,</p>
  
  <p>Inside the procedure, I want to hit a HTTP URL so behind that a java program will execute.</p>
  
  <p><strong>Approach :</strong></p>
  
  <pre><code>declare 
   req   UTL_HTTP.REQ;
  BEGIN
   req := UTL_HTTP.BEGIN_REQUEST('http://dev.xxx.com/yyy/zzz/aaa/triggerJob');
   dbms_output.put_line('hitting');
  EXCEPTION
   WHEN UTL_HTTP.END_OF_BODY THEN
      dbms_output.put_line('exception');
  END;
  </code></pre>
  
  <p>DBMS OUTPUT is hitting </p>
  
  <p>-- But it is not hitting actually!</p>
  
  <p><strong>Approach 2</strong></p>
  
  <pre><code>declare 
   req   UTL_HTTP.REQ;
   resp  UTL_HTTP.RESP;
  BEGIN
   req := UTL_HTTP.BEGIN_REQUEST('http://dev.xxx.com/yyy/zzz/aaa/triggerJob');
   UTL_HTTP.SET_HEADER(req, 'User-Agent', 'Mozilla/4.0');
   resp := UTL_HTTP.GET_RESPONSE(req);
  UTL_HTTP.END_RESPONSE(resp);
   dbms_output.put_line('hitting');
  
  EXCEPTION
   WHEN UTL_HTTP.END_OF_BODY THEN
      dbms_output.put_line('exception');
  END;
  </code></pre>
  
  <p>With this, I am getting below errors while executing.</p>
  
  <p><a href="https://i.stack.imgur.com/9zqAO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9zqAO.png" alt="enter image description here"></a></p>