简体   繁体   English

java.sql.SQLException: ORA-06550: 从 java 代码调用过程后

[英]java.sql.SQLException: ORA-06550: after calling procedure from java code

Hi I have problem with calling store procedure.嗨,我在调用存储过程时遇到问题。 when i am trying to call my procedure from my following java code当我试图从下面的 Java 代码中调用我的过程时

connection = ConnectionManager.getInstance().getConnection(dataBaseURL, serverName, portNumber, sid, username, password);

callable = connection.prepareCall("{call SCHEMA_RESTORE.restore()}");

callable.executeUpdate();
..................................

I am getting this Exception我收到此异常

Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7:

PLS-00201: identifier 'SCHEMA_RESTORE.RESTORE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)

My Prodedure is我的程序是

CREATE OR REPLACE PACKAGE BODY SCHEMA_RESTORE IS 
  PROCEDURE backup (pbRecreateBackupTable IN BOOLEAN DEFAULT FALSE)
    IS
      TableAlreadyExists EXCEPTION;
      PRAGMA EXCEPTION_INIT (TableAlreadyExists, -955);
      nCount NUMBER;
      CURSOR cTables IS SELECT tbls.table_name tbl, SUBSTR(tbls.table_name,4) name FROM user_tables tbls, FT_T_TBDF tbdf
        WHERE tbls.table_name NOT LIKE gsPrefix || '%' AND tbls.table_name NOT LIKE 'FT_CFG%' AND tbls.table_name NOT IN ('FT_WF_APEV','FT_WF_WFTJ','FT_WF_WFTN','FT_WF_WFNP','FT_WF_WFNV','FT_WF_WFIO','FT_WF_WFGV','FT_WF_WFND','FT_WF_WFDF','EXCEPTIONS','TESTDSFP') and tbls.table_name NOT LIKE 'FT_LOG%'
          AND tbdf.tbl_id(+) = SUBSTR(tbls.table_name,-4) AND tbdf.tbl_desc NOT LIKE '%Note: This table is obsolete%';
BEGIN

        RAISE;
    END;
  END LOOP; 
EXCEPTION
  WHEN OTHERS THEN
    RAISE;
END backup; 

The error message says that SCHEMA_RESTORE.RESTORE cannot be found.错误消息说找不到 SCHEMA_RESTORE.RESTORE。 There are several possible causes:有几种可能的原因:

  • The package (and procedure) are in a different schema, eg you compiled it as user A but are trying to call them as user B.包(和过程)处于不同的模式中,例如,您以用户 A 的身份编译它,但试图以用户 B 的身份调用它们。
  • You don't have the access right to execute procedures from the package.您没有从包中执行过程的访问权限。 Thus it becomes invisible.因此它变得不可见。
  • You have defined the procedure in the package body, but haven't declared it in the package header.您已经在包体中定义了过程,但没有在包头中声明它。

A further problem I can see are the parentheses.我可以看到的另一个问题是括号。 If you call a procedure without arguments, the prentheses shoul be omitted:如果您调用不带参数的过程,则应省略括号:

{ call SCHEMA_RESTORE.restore }

It comes when you make a procedure in one user and connect the db in another.当您在一个用户中创建一个过程并在另一个用户中连接数据库时,它就会出现。 To solve this issue try this要解决这个问题试试这个

GRANT EXECUTE ON procedureName TO username

Otherwise connect with correct username which you using否则使用您使用的正确用户名连接

Did the procedure compile successfully ?程序编译成功了吗? Also check if you can see it via some editor (PL/SQL dev ?) under the schema还要检查您是否可以通过模式下的某个编辑器(PL/SQL dev ?)看到它

or you may use this to see if it is there -或者你可以用它来看看它是否在那里——

SELECT * FROM DBA_OBJECTS WHERE object_name = '%your proc name%';

暂无
暂无

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

相关问题 java.sql.SQLException:ORA-06550 - java.sql.SQLException: ORA-06550 JDBC-从JAVA调用PLSQL会给出Java.sql.SQLException:ORA-06550 - JDBC - Calling PLSQL from JAVA gives Java.sql.SQLException: ORA-06550 Java语言-java.sql.SQLException:ORA-06550 - Java Language - java.sql.SQLException: ORA-06550 java.sql.SQLException:ORA-06550:第1行第13列:授予用户对EXECUTE包的权限后 - java.sql.SQLException: ORA-06550: line 1, column 13: After granting user permission to EXECUTE package 调用SQL过程:SQL异常 - 代码:6550 ORA-06550 - Calling SQL Procedure: SQL exception - code: 6550 ORA-06550 尝试从Java代码调用存储的Oracle过程时,我得到ORA-06550 - I'm getting ORA-06550 when trying to call a stored Oracle procedure from Java code 引起:java.sql.SQLException:ORA-06550:第 1 行,第 7 列:PLS-00306:ZDBC11CAA5BDA99F77E6FB4DABD_SPE_FA 7 调用中的 ZDBC11CAA5BDA99F77E6FB4DABD8SPE_7 的错误编号或类型 - Caused by: java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'PR_SP_FAHMI' java.sql.SQLException:ORA-01843:调用过程时无效的月份 - java.sql.SQLException: ORA-01843: not a valid month when calling a procedure 永久性 ORA-06550 错误,使用 jdbc 从 java 应用程序调用存储的 function - Permanent ORA-06550 error, calling stored function from java application using jdbc java.sql.SQLException:ORA-01747 - java.sql.SQLException: ORA-01747
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM