简体   繁体   English

存储过程错误PLS-00201:必须声明标识符“UTL_HTTP”

[英]Stored procedure error PLS-00201: identifier 'UTL_HTTP' must be declared

I am trying to create a stored procedure that request some XML data from a service. 我正在尝试创建一个从服务请求一些XML数据的存储过程。 I have found several examples on-line and all of them point to using this UTL_HTTP package. 我在网上找到了几个例子,所有这些例子都指向使用这个UTL_HTTP包。 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;

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. 我正在使用Oracle Express Edition,我已经尝试授予我的用户对该包的执行权限。 It did not work. 那没起效。 What else can I look at? 我还能看到什么? What else could be causing this? 还有什么可能导致这个? Thanks! 谢谢!

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. 您的用户以某种方式无法访问UTL_HTTP包。 Make sure your user has the EXECUTE permission on the package: 确保您的用户对包具有EXECUTE权限:

GRANT EXECUTE ON SYS.UTL_HTTP TO my_user;

Note that you might have to do this as SYS. 请注意,您可能必须以SYS身份执行此操作。

Using SQL Developer (which I can recommend if you're doing PL/SQL development), see if you can then look at the package somehow. 使用SQL Developer(如果您正在进行PL / SQL开发,我可以推荐),看看您是否可以以某种方式查看包。 If that does not help, please post the permissions that your user currently has. 如果这没有帮助,请发布您的用户当前拥有的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM