<bdo id='Tkc30'></bdo><ul id='Tkc30'></ul>
  • <tfoot id='Tkc30'></tfoot>
    <i id='Tkc30'><tr id='Tkc30'><dt id='Tkc30'><q id='Tkc30'><span id='Tkc30'><b id='Tkc30'><form id='Tkc30'><ins id='Tkc30'></ins><ul id='Tkc30'></ul><sub id='Tkc30'></sub></form><legend id='Tkc30'></legend><bdo id='Tkc30'><pre id='Tkc30'><center id='Tkc30'></center></pre></bdo></b><th id='Tkc30'></th></span></q></dt></tr></i><div id='Tkc30'><tfoot id='Tkc30'></tfoot><dl id='Tkc30'><fieldset id='Tkc30'></fieldset></dl></div>
    1. <small id='Tkc30'></small><noframes id='Tkc30'>

    2. <legend id='Tkc30'><style id='Tkc30'><dir id='Tkc30'><q id='Tkc30'></q></dir></style></legend>

        在 Oracle 存储过程中访问另一个用户的表

        Accessing another user#39;s table within an Oracle Stored Procedure(在 Oracle 存储过程中访问另一个用户的表)
        <i id='2aYgB'><tr id='2aYgB'><dt id='2aYgB'><q id='2aYgB'><span id='2aYgB'><b id='2aYgB'><form id='2aYgB'><ins id='2aYgB'></ins><ul id='2aYgB'></ul><sub id='2aYgB'></sub></form><legend id='2aYgB'></legend><bdo id='2aYgB'><pre id='2aYgB'><center id='2aYgB'></center></pre></bdo></b><th id='2aYgB'></th></span></q></dt></tr></i><div id='2aYgB'><tfoot id='2aYgB'></tfoot><dl id='2aYgB'><fieldset id='2aYgB'></fieldset></dl></div>

            <small id='2aYgB'></small><noframes id='2aYgB'>

            <legend id='2aYgB'><style id='2aYgB'><dir id='2aYgB'><q id='2aYgB'></q></dir></style></legend>
              <tbody id='2aYgB'></tbody>
          1. <tfoot id='2aYgB'></tfoot>
                  <bdo id='2aYgB'></bdo><ul id='2aYgB'></ul>
                  本文介绍了在 Oracle 存储过程中访问另一个用户的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在编写一个存储过程来将数据从一个用户的表复制到另一个模式.基本上,它是一系列 INSERT .. SELECT 语句,例如:

                  I'm writing a stored procedure to copy data from one user's table to another schema. Basically, it is a series of INSERT .. SELECT statements such as this:

                  INSERT INTO GESCHAEFTE
                    SELECT *
                      FROM TURAT03.GESCHAEFTE
                     WHERE kong_nr = 1234;
                  

                  这在从 sqlplus(或我的 TOAD ;-))发出时工作正常,所以我知道我有足够的权限,但是当这是这样的存储过程的一部分时:

                  This works fine when issueing from sqlplus (or TOAD for me ;-)) so I know that I have sufficient privileges, but when this is part of stored procedure like this:

                  CREATE OR REPLACE FUNCTION COPY_KONG
                      (pKongNr IN NUMBER)
                      RETURN NUMBER
                      AUTHID CURRENT_USER
                  IS
                  BEGIN
                     INSERT INTO GESCHAEFTE
                        SELECT *
                         FROM TURAT03.GESCHAEFTE
                         WHERE kong_nr = pKongNr;
                  END;
                  

                  我收到一个 Oracle 错误:

                  I get an Oracle error:

                  [Error] ORA-00942 (11: 22): PL/SQL: ORA-00942: table or view does not exist
                  

                  如您所见,我已经插入了一个AUTHID,但无济于事.

                  As you can see, I've already inserted an AUTHID, but to no avail.

                  我还能做什么?我的想法差不多到此为止了.

                  What else can I do? I'm pretty much at the end of my ideas here.

                  推荐答案

                  必须授予过程所有者直接访问底层对象的权限,不是通过角色.要与您的过程具有相同级别的访问权限,请使用以下命令:

                  The owner of a procedure must be granted privilege to access the underlying objects directly, not through a role. To have the same level of access as your procedures, use the following commands:

                  SET ROLE NONE;
                  

                  要从过程访问另一个表,您需要直接被授予 SELECT 权限,而不是通过角色:

                  To access another table from a procedure, you need to be granted SELECT directly, not through a role:

                  GRANT SELECT ON TURAT03.GESCHAEFTE TO <your_user>;
                  

                  Tom Kyte 的这篇文章包含更多信息.

                  这篇关于在 Oracle 存储过程中访问另一个用户的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to View Oracle Stored Procedure using SQLPlus?(如何使用 SQLPlus 查看 Oracle 存储过程?)
                  How to Pass Java List of Objects to Oracle Stored Procedure Using MyBatis?(如何使用 MyBatis 将 Java 对象列表传递给 Oracle 存储过程?)
                  What is dynamic SQL?(什么是动态 SQL?)
                  Mysql - How to quit/exit from stored procedure(Mysql - 如何退出/退出存储过程)
                  How to find a text inside SQL Server procedures / triggers?(如何在 SQL Server 程序/触发器中查找文本?)
                  how to declare %ROWTYPE of a variable that is a weakly typed SYS_REFCURSOR?(如何声明弱类型 SYS_REFCURSOR 变量的 %ROWTYPE?)
                    <tbody id='rdOvI'></tbody>
                  <legend id='rdOvI'><style id='rdOvI'><dir id='rdOvI'><q id='rdOvI'></q></dir></style></legend>

                • <tfoot id='rdOvI'></tfoot>

                    <small id='rdOvI'></small><noframes id='rdOvI'>

                      <bdo id='rdOvI'></bdo><ul id='rdOvI'></ul>

                        <i id='rdOvI'><tr id='rdOvI'><dt id='rdOvI'><q id='rdOvI'><span id='rdOvI'><b id='rdOvI'><form id='rdOvI'><ins id='rdOvI'></ins><ul id='rdOvI'></ul><sub id='rdOvI'></sub></form><legend id='rdOvI'></legend><bdo id='rdOvI'><pre id='rdOvI'><center id='rdOvI'></center></pre></bdo></b><th id='rdOvI'></th></span></q></dt></tr></i><div id='rdOvI'><tfoot id='rdOvI'></tfoot><dl id='rdOvI'><fieldset id='rdOvI'></fieldset></dl></div>