存储过程错误PLS-00201:必须声明标识符'UTL_HTTP' [英] Stored procedure error PLS-00201: identifier 'UTL_HTTP' must be declared
问题描述
我正在尝试创建一个存储过程,该存储过程向服务请求一些XML数据.我在网上找到了几个示例,所有示例都指向使用此UTL_HTTP包.但是,每次我尝试用其编译存储过程时,都会收到错误消息:
I am trying to create a stored procedure that request some XML data from a service. I have found several examples on-line and all of them point to using this UTL_HTTP package. However, every time I tried to compile my store procedure with that I get the error:
PLS-00201: identifier 'UTL_HTTP' must be declared
这是我要使用的代码的基本框架.
Here is the basic skeleton of the code I want to use.
PROCEDURE GET_XML_DATA2 AS
BEGIN
DECLARE
v_soap_request VARCHAR2(32767);
v_soap_response VARCHAR2(32767);
v_http_request UTL_HTTP.req; --Fails here
v_http_response UTL_HTTP.resp; -- Fails here too
v_action VARCHAR2(4000) := '';
BEGIN
null;
END;
END GET_XML_DATA2;
它在指示的行中失败,并且无法编译.我正在使用Oracle Express Edition,并且已经尝试授予用户对该程序包的执行权限.那没起效. 我还能看什么?还有什么可能导致这种情况? 谢谢!
It fails in the indicated lines and does not compile. I am using Oracle Express Edition and I have already tried to grant my user execute rights to that package. It did not work. What else can I look at? What else could be causing this? Thanks!
推荐答案
正如您已经弄清楚自己一样,这似乎是权限问题.您的用户确实无法访问UTL_HTTP软件包.确保您的用户对软件包具有EXECUTE权限:
As you already figured out yourself, this seems to be a permission problem. Your user does somehow not have access to the UTL_HTTP package. Make sure your user has the EXECUTE permission on the package:
GRANT EXECUTE ON SYS.UTL_HTTP TO my_user;
请注意,您可能必须以SYS身份执行此操作.
Note that you might have to do this as SYS.
使用SQL Developer(如果您正在进行PL/SQL开发,可以推荐使用该工具),然后查看是否可以以某种方式查看该软件包.如果这样做没有帮助,请发布您的用户当前拥有的权限.
Using SQL Developer (which I can recommend if you're doing PL/SQL development), see if you can then look at the package somehow. If that does not help, please post the permissions that your user currently has.
这篇关于存储过程错误PLS-00201:必须声明标识符'UTL_HTTP'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!