OCP Blog
Super DBA
Load XML file to oracle database in varchar2 type
by Vazha Mantua Wednesday, December 21, 2011 3:30 PM
    • Good Day all,
    • Today we show example of possibility of loading xml file to oracle10g database to text.
    • This method is very easy of getting some data from XML file to oracle database.
    • declare
    •   v_req   utl_http.req;
    •   v_resp  utl_http.resp;
    •   v_value VARCHAR2(1024);
    •   v_url varchar2(100);
  • begin
    • ---
    •   v_url:='http://192.0.0.16/test.xml';
    •   v_req := utl_http.begin_request(v_url);
    •   v_resp := utl_http.get_response(v_req);
    •   utl_http.read_text(v_resp, v_value);
    •   dbms_output.put_line(v_value);
    •   utl_http.end_response(v_resp);
    • ---
    • end;

Let see packages which we used on this example:

utl_http.begin_request:

Begins a new HTTP request. When the function returns, the UTL_HTTP  package has established the network connection to the target Web server, or the proxy server if a proxy server is to be used, and has sent the HTTP request line. The PL/SQL program should continue the request by calling some other API to complete the request.

utl_http.get_response:

Reads the HTTP response and processes the status line and HTTP response headers. The status code, reason phrase and the HTTP protocol version are stored in the response record.

utl_http.read_text:

Reads the HTTP response body in text form and returns the output in the caller-supplied buffer. The end_of_body exception will be raised if the end of the HTTP response body is reached. Text data is automatically converted from the response body character set to the database character set.

utl_http.end_response:

Ends the HTTP response completing the HTTP request and response. Unless a HTTP 1.1 persistent  connection is used in this request, the network connection is closed.

 

Tags: , ,

Comments (6) -

1/14/2012 2:24:44 PM #

Villas for Rent in Italy

Reads the HTTP response and processes the status line and HTTP response headers. The status code, reason phrase and the HTTP protocol version are stored in the response record.

Villas for Rent in Italy United States

2/12/2012 6:53:41 AM #

Flooring Ideas

Reads the HTTP response and processes the status line and HTTP response headers. The status code, reason phrase and the HTTP protocol version are stored in the response record.

Flooring Ideas United States

3/30/2012 12:54:33 AM #

FunnyBooks

Begins a new HTTP request. When the function returns, the UTL_HTTP  package has established the network connection to the target Web server, or the proxy server if a proxy server is to be used, and has sent the HTTP request line. The PL/SQL program should continue the request by calling some other API to complete the request.

FunnyBooks United States

5/5/2012 11:38:11 AM #

Challenge Coins

Ahaa, its good dialogue about this paragraph at this place at this blog, I have read all that, so now me also commenting here cele mai noi jocuri online.

Challenge Coins United Kingdom

6/3/2012 2:30:47 AM #

Directory Submission Service

Today we show example of possibility of loading xml file to oracle10g database to text.

Directory Submission Service United Kingdom

6/3/2012 2:30:59 AM #

Directory Submission Service

Ahaa, its good dialogue about this paragraph at this place at this blog, I have read all that, so now me also commenting here cele mai noi jocuri online.

Directory Submission Service United Kingdom

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Filter by APML

Calendar

<<  November 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

TextBox