简体   繁体   English

从Java调用执行PLSQL时的PLS-00201

[英]PLS-00201 when calling executing PLSQL from java

When i am trying to execute the procedure in Oracle itself, it works fine. 当我尝试在Oracle本身中执行该过程时,它工作正常。 But when i call the same procedure from java, i am getting PLS-00201 . 但是,当我从java调用相同的过程时,我正在获取PLS-00201。 Kindly let me know if there is any mistake. 请让我知道是否有任何错误。

java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00201: identifier 'PR_REJECT_FILE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:330)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:287)

Here is my procedure call: 这是我的过程调用:

CallableStatement cs=null;

    try
    {
        cs = this.dteConn.prepareCall("{ call PR_REJECT_FILE (?,?,?) }");
        cs.setString(1,status);
        cs.setInt(2, fileid);
        cs.setString(3,t_id);
        cs.execute();

    }
    catch (Exception e) 
    {
        e.printStackTrace();
    }

What is the PR_REJECT_FILE ? 什么是PR_REJECT_FILE I mean is it a function or a procedure? 我的意思是说它是功能还是程序? the call command is not for using with PL/SQL it's for using in sql*plus. call命令不是用于PL / SQL,而是用于sql * plus。 I mean you can't call a procedure or function like that you did in your code in PLSQL, it depends on the output of PR_REJECT_FILE and also the user or schema that owns it. 我的意思是,您不能像在PLSQL代码中那样调用过程或函数,它取决于PR_REJECT_FILE的输出以及拥有它的用户或模式。

if it is procedure you can call it like this: 如果是过程,则可以这样调用:

begin
PR_REJECT_FILE (?,?,?);
end;

if it is a function returning a scalar value you can call it like below: 如果它是一个返回标量值的函数,则可以像下面这样调用它:

select PR_REJECT_FILE (?,?,?) from dual;

If PR_REJECT_FILE is for another user and you have permission on executing it then you have to bring that user's prefix in above codes( user.PR_REJECT_FILE ). 如果PR_REJECT_FILE是给另一个用户的,并且您有权执行它,则必须在上述代码( user.PR_REJECT_FILE )中带入该用户的前缀。

I prefer to search on using packages, procedures or functions with JDBC. 我更喜欢在JDBC中使用包,过程或函数进行搜索。

Grant execute permission on your procedure to the db username used in your Java Application. 将过程的执行权限授予Java应用程序中使用的db用户名。

GRANT EXECUTE ON PR_REJECT_FILE TO DBUsername_used_in_your_Java_Application;

eg 例如

GRANT EXECUTE ON PR_REJECT_FILE TO APPDBUSERNAME;

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

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