当前位置:Gxlcms >
数据库问题 >
PL/SQL: Statement ignored 异常 关于存储过程的调用
PL/SQL: Statement ignored 异常 关于存储过程的调用
时间:2021-07-01 10:21:17
帮助过:50人阅读
-06550: 第 1 行, 第 7
列:
PLS-00201: 必须声明标识符 ‘PROC_COUNTYEARSAL‘
ORA-06550: 第 1 行, 第 7
列:
PL/
SQL: Statement ignored
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112
)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331
)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288
)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743
)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:212
)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:951
)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160
)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285
)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3390
)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4223
)
at com.itheima.test.TestJdbc.test02(TestJdbc.java:47
)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62
)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43
)
at java.lang.reflect.Method.invoke(Method.java:498
)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50
)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12
)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47
)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17
)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325
)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78
)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57
)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290
)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71
)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288
)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58
)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268
)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363
)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137
)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68
)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47
)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242
)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70
)
Process finished with exit code -1
异常的原因是因为在进行存储过程调用的中,数据库中没有该存储过程,
下面是我写的代码,因为在其他用户下面创建了一个存储过程,该用户下面并没有,而在进行数据库连接的时候连接了scott用户造成的,算是粗心造成的吧
@Test
public void test02() throws Exception {
String driver = "oracle.jdbc.OracleDriver";
String url = "jdbc:oracle:thin:@192.168.80.88:1521:orcl";
String username = "scott";
String password = "tiger";
Class.forName(driver);
Connection connection = DriverManager.getConnection(url, username, password);
CallableStatement pstm = connection.prepareCall("{call proc_countyearsal(?, ?)}");
//给参数赋值
pstm.setObject(1, 7788);
pstm.registerOutParameter(2, OracleTypes.VARCHAR);
//执行数据库查询操作
pstm.execute();
//输出结果[第二个参数]
System.out.println(pstm.getObject(2));
//释放资源
pstm.close();
connection.close();
}
PL/SQL: Statement ignored 异常 关于存储过程的调用
标签:child cep dev exce eva obj junit4 except rman