问题描述
- 关于调用oracle存储过程
-
这样调用 CallableStatement c=conn.prepareCall("{call smi.CallReport.sp_RptCallCenterStat(?,?,?,?,?,?,?,?)}");c.setString(1, "2014-10-11");
c.setString(2, "2015-11-11");
c.setInt(3, 301);
c.setString(4, "441");
c.setString(5, "zh_cn");
c.setInt(6, 1);
c.setInt(7, 32);
c.setString(8, "mycur");
ResultSet rs=c.executeQuery();报错
java.sql.SQLException: ORA-06550: 第 1 行, 第 22 列:
PLS-00302: 必须声明 'SP_RPTCALLCENTERSTAT' 组件
ORA-06550: 第 1 行, 第 7 列:
PL/SQL: Statement ignoredat 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:745) at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:218) at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:969) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1190) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415) at com.mckj.subscription.timertask.SubscriptionPushTimerTask.hjzxztzbPush(SubscriptionPushTimerTask.java:85) at com.mckj.subscription.timertask.SubscriptionPushTimerTask.runQuestionnairePush(SubscriptionPushTimerTask.java:44) 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:483) at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:744) 特别急,在线等
解决方案
一:无返回值的存储过程
存储过程为:
CREATE OR REPLACE PROCEDURE TESTA(PARA1 IN VARCHAR2,PARA2 IN VARCHAR2) AS
BEGIN
INSERT INTO HYQ.B_ID (I_ID,I_NAME) VALUES (PARA1, PARA2);
END TESTA;
然后呢,在java里调用时就用下面的代码:
package com.hyq.......
答案就在这里:Oracle存储过程的调用
时间: 2025-01-19 16:24:58