码迷,mamicode.com
首页 > 数据库 > 详细

ORACLE的http访问

时间:2016-08-09 20:47:58      阅读:350      评论:0      收藏:0      [点我收藏+]

标签:

ORACLE利用UTL_HTTP包提供了访问HTTP的工具。

下面这段代码是网上找的,可以直接在plsql中运行。

declare

req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
val varchar2(32767);
begin

req := UTL_HTTP.BEGIN_REQUEST(‘http://www.sohu.com‘);
utl_http.set_header(req, ‘Content-Type‘, ‘text/html; charset=utf-8‘);--add this
resp := UTL_HTTP.GET_RESPONSE(req);
utl_http.read_line(resp, val, true);
utl_http.end_response(resp);
dbms_output.put_line(val);

EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
end;

 

如果只是想调用某个url,可以用下面的语句

select utl_http.request(‘http://www.sohu.com‘) from dual

以上内容没有深究,有空再研究,先记录下来

 

ORACLE的http访问

标签:

原文地址:http://www.cnblogs.com/blaast/p/5754487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!