嗨,我有调用存储过程的问题。 当我试图从我的以下java代码中调用我的程序时
connection = ConnectionManager.getInstance().getConnection(dataBaseURL, serverName, portNumber, sid, username, password);
callable = connection.prepareCall("{call SCHEMA_RESTORE.restore()}");
callable.executeUpdate();
..................................
我收到此例外
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)
我的Prodedure
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;
答案 0 :(得分:3)
错误消息显示无法找到SCHEMA_RESTORE.RESTORE。有几种可能的原因:
我能看到的另一个问题是括号。如果你调用一个没有参数的程序,那么应该省略这些假设:
{ call SCHEMA_RESTORE.restore }
答案 1 :(得分:3)
当您在一个用户中创建过程并将db连接到另一个用户时,就会出现这种情况。 要解决此问题,请尝试此
GRANT EXECUTE ON procedureName TO username
否则请使用正确的用户名
进行连接答案 2 :(得分:1)
程序编译成功了吗?还要检查是否可以通过模式
下的某个编辑器(PL / SQL dev?)查看它或者您可以使用它来查看它是否存在 -
SELECT * FROM DBA_OBJECTS WHERE object_name = '%your proc name%';