简体   繁体   English

使用另一个架构中的表创建存储过程会抛出PLS-00201

[英]Create stored procedure with table from another schema throws PLS-00201

Oracle 10g. Oracle 10g。 I'm new to procedures, so maybe I'm missing something obvious. 我是过程的新手,所以也许我缺少明显的东西。

Schema owner ABC has table T2001_WRITEOFF. 架构所有者ABC具有表T2001_WRITEOFF。 First I had granted SIUD to some_update_role, and granted that role to developer user IJK. 首先,我将SIUD授予some_update_role,并将该角色授予开发人员用户IJK。 User IJK then created synonym T2001_WRITEOFF for ABC.T2001_WRITEOFF; 然后,用户IJK为ABC.T2001_WRITEOFF创建了同义词T2001_WRITEOFF; This worked with normal SQL DML commands. 这适用于普通的SQL DML命令。

However, I read elsewhere on here that grants via a role do not work in stored procedures. 但是,我在这里的其他地方读到,通过角色进行授予在存储过程中不起作用。 I dropped the synonym from IJK; 我放弃了IJK的同义词; then from ABC, granted SIUD directly to IJK. 然后从ABC,直接将SIUD授予IJK。 From IJK, normal SQL DML works. 从IJK,正常的SQL DML起作用。

When I try to create a simple procedure as follows, it throws PLS-00201 identifier 'T2001_WRITEOFF' must be declared, and points to the 2nd line. 当我尝试创建如下所示的简单过程时,它会抛出PLS-00201标识符'T2001_WRITEOFF',并且必须指向第二行。 This error is the same whether I use the role grants or not. 无论我是否使用角色授予,此错误都是相同的。

create or replace procedure woof1(
    fooname in T2001_WRITEOFF.territory%TYPE,  <=== error points here
    bardesc IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
BEGIN
    INSERT into T2001_WRITEOFF
    VALUES ( fooname, bardesc);
END woof1;
/

Thanks in advance for help 预先感谢您的帮助

JimR 吉姆

In order to make role right applicable in stored procedures you might want to look at authid current_user in the oracle documentation . 为了使角色权限适用于存储过程,您可能需要查看oracle文档中的authid current_user Also helpful: http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/subprograms.htm#LNPLS682 也有帮助: http : //docs.oracle.com/cd/E11882_01/appdev.112/e25519/subprograms.htm#LNPLS682

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

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