java.sql.SQLException:ORA-06550:从Java代码调用过程之后 [英] java.sql.SQLException: ORA-06550: after calling procedure from java code
本文介绍了java.sql.SQLException:ORA-06550:从Java代码调用过程之后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在调用存储过程时遇到问题. 当我尝试从下面的Java代码中调用过程时
Hi I have problem with calling store procedure. when i am trying to call my procedure from my following java code
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)
我的程序是
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;
推荐答案
错误消息指出找不到SCHEMA_RESTORE.RESTORE.有几种可能的原因:
The error message says that SCHEMA_RESTORE.RESTORE cannot be found. There are several possible causes:
- 程序包(和过程)处于不同的架构,例如您以用户A的身份对其进行了编译,但正尝试以用户B的身份对其进行调用.
- 您无权执行该程序包中的过程.因此它变得不可见.
- 您已在程序包主体中定义了该过程,但尚未在程序包头中声明它.
我可以看到的另一个问题是括号.如果您调用不带参数的过程,则应忽略假义:
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 }
这篇关于java.sql.SQLException:ORA-06550:从Java代码调用过程之后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文