Oracle9i Supplied PL/SQL Packages and Types Reference Release 1 (9.0.1) Part Number A89852-02 |
|
UTL_HTTP , 5 of 59
This function returns a PL/SQL table of 2000-byte pieces of the data retrieved from the given URL.
type html_pieces is table of varchar2(2000) index by binary_integer; UTL_HTTP.REQUEST_PIECES (url IN VARCHAR2, max_pieces IN NATURAL DEFAULT 32767, proxy IN VARCHAR2 DEFAULT NULL, wallet_path IN VARCHAR2 DEFAULT NULL, wallet_password IN VARCHAR2 DEFAULT NULL)RETURN html_pieces;
pragma restrict_references (request_pieces, wnds, rnds, wnps, rnps);
Table 78-8 shows the parameters for the REQUEST_PIECES
function.
REQUEST_PIECES
returns a PL/SQL table of type UTL_HTTP
.HTML_PIECES
. Each element of that PL/SQL table is a string of maximum length 2000. The elements of the PL/SQL table returned by REQUEST_PIECES
are successive pieces of the data obtained from the HTTP request to that URL.
INIT_FAILED
REQUEST_FAILED
The URL passed as an argument to this function will not be examined for illegal characters, for example, spaces, per the URL specification RFC 2396. The caller should escape those characters with the UTL_URL package. See the comments of the package for the list of legal characters in URLs. Note that URLs should consist of US-ASCII characters only. The use of non-US-ASCII characters in a URL is generally unsafe.
Each entry of the PL/SQL table (the "pieces") returned by this function may not be filled to their fullest capacity. The function may start filling the data in the next piece before the previous "piece" is totally full.
Please see the documentation of the function set_wallet on the use of an Oracle wallet, which is required for accessing HTTPS Web servers.
Unless response error check is turned on, this function does not raise an exception when a 4xx or 5xx response is received from the Web server. Instead, it returns the formatted error message from the Web server:
<HTML> <HEAD> <TITLE>Error Message</TITLE> </HEAD> <BODY> <H1>Fatal Error 500</H1> Can't Access Document: http://home.nothing.comm. <P> <B>Reason:</B> Can't locate remote host: home.nothing.comm. <P> <P><HR> <ADDRESS><A HREF="http://www.w3.org"> CERN-HTTPD3.0A</A></ADDRESS> </BODY> </HTML>
SET SERVEROUTPUT ONDECLAREx utl_http.html_pieces; len PLS_INTEGER;BEGINx := utl_http.request_pieces('http://www.oracle.com/', 100); dbms_output.put_line(x.count || ' pieces were retrieved.'); dbms_output.put_line('with total length '); IF x.count < 1 THENdbms_output.put_line('0');ELSElen := 0; FOR i in 1..x.count LOOPlen := len + length(x(i));END LOOP; dbms_output.put_line(i);END IF; END; / -- Output Statement processed. 4 pieces were retrieved. with total length 7687
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|