How to Read Web Pages Using utl_http.request_pieces

UTL_HTTP package provides easy to use methods to fetch data from web using http protocol. Today, one of my co-workers complained that “utl_http.request” method returns only a small part of the web page instead of full html. She says she already uses it to fetch from other web pages without any problem. The utl_http.request method returns the requested page as a single string. When I check the documents, I see that it intentionally returns only first 2000 characters, and we should use “utl_http.request_pieces” method if we need to fetch more than 2000 characters. The UTL_HTTP.REQUEST_PIECES returns “utl_http.html_pieces” which is defined as a PLSQL table of 2000 character strings:

So I created a small function to demonstrate how we can fetch a web page using utl_http.request_pieces:

And tested it:

Please share

AWS Big Data Specialist. Oracle Certified Professional (OCP) for EBS R12, Oracle 10g and 11g. Co-author of "Expert Oracle Enterprise Manager 12c" book published by Apress. Awarded as Oracle ACE (in 2011) and Oracle ACE Director (in 2016) for the continuous contributions to the Oracle users community. Founding member, and vice president of Turkish Oracle User Group (TROUG). Presented at various international conferences including Oracle Open World.


  1. rohan

    when I tried to run

    I get anĀ  error

    unknown command beginning “TYPE html_…” – rest of line ignored.

Leave Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.