Spring执行存储过程

时间:2014-02-13 10:12:27

标签: java spring oracle

使用Spring框架调用存储过程时出现以下错误, 我做错了什么?

弹簧:3.2 甲骨文:11g

enter image description here

这是我的包裹体:

create or replace 
PACKAGE BODY DEVICE_CHANGE_EVENT_PK AS

 PROCEDURE deletemsisdn(p_msisdn IN NUMBER, response OUT NUMBER)
  IS
     err_number  number;

  BEGIN
     response := 1;
  END;


 PROCEDURE deletemsisdn
  IS
     err_number  number;

  BEGIN
     err_number := 1;
  END;


END DEVICE_CHANGE_EVENT_PK;

Spring StoredProcedure类:

package com.mkyong.component.dao;

import java.sql.Types;
import java.util.Map;

import javax.sql.DataSource;

import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.StoredProcedure;


public class DeleteMsisdnSPImplPure extends StoredProcedure implements DeleteMsisdnSP{

    public static String P_MSISDN="p_msisdn";
    public static String RESPONSE="response";

    public DeleteMsisdnSPImplPure(DataSource dataSource ){      
        super(dataSource,"AHMETK.DEVICE_CHANGE_EVENT_PK.DELETEMSISDN");     
    }

    @Override
    public Object execute(long msisdn){
        super.execute();
        return "OK";
    }

}

我遇到错误..

Feb 13, 2014 11:59:34 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
Feb 13, 2014 11:59:34 AM org.springframework.jdbc.support.SQLErrorCodesFactory <init>
INFO: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
Exception in thread "main" org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{call AHMETK.DEVICE_CHANGE_EVENT_PK.DELETEMSISDN()}]; SQL state [72000]; error code [4063]; ORA-04063: package body "AHMETK.DEVICE_CHANGE_EVENT_PK" has errors
ORA-06508: PL/SQL: could not find program unit being called: "AHMETK.DEVICE_CHANGE_EVENT_PK"
ORA-06512: at line 1
; nested exception is java.sql.SQLException: ORA-04063: package body "AHMETK.DEVICE_CHANGE_EVENT_PK" has errors
ORA-06508: PL/SQL: could not find program unit being called: "AHMETK.DEVICE_CHANGE_EVENT_PK"
ORA-06512: at line 1

    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1036)
    at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1070)
    at org.springframework.jdbc.object.StoredProcedure.execute(StoredProcedure.java:125)
    at com.mkyong.component.dao.DeleteMsisdnSPImplPure.execute(DeleteMsisdnSPImplPure.java:24)
    at com.mkyong.component.dao.AdcDaoImplExtended.deleteMisdnViaStoredProcedure(AdcDaoImplExtended.java:35)
    at com.mkyong.component.services.MyService.deleteMisdnViaStoredProcedure(MyService.java:104)
    at com.mkyong.component.services.MyService$$FastClassByCGLIB$$1e2fd8be.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
    at com.mkyong.component.services.MyService$$EnhancerByCGLIB$$fa861a3e.deleteMisdnViaStoredProcedure(<generated>)
    at com.mkyong.common.App.<init>(App.java:50)
    at com.mkyong.common.App.main(App.java:58)
Caused by: java.sql.SQLException: ORA-04063: package body "AHMETK.DEVICE_CHANGE_EVENT_PK" has errors
ORA-06508: PL/SQL: could not find program unit being called: "AHMETK.DEVICE_CHANGE_EVENT_PK"
ORA-06512: at line 1

    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
    at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:192)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:204)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1041)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1329)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3584)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3685)
    at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4714)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1376)
    at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1072)
    at org.springframework.jdbc.core.JdbcTemplate$6.doInCallableStatement(JdbcTemplate.java:1070)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1020)
    ... 15 more

0 个答案:

没有答案