存储过程:
Create or replace package statistics_pkg 
is
  type ResultRows is ref cursor;
  procedure Expired_domain(staffId        VARCHAR2, 
                           timeUnits      VARCHAR2, 
                           rows     out   ResultRows);
end statistics_pkg;
/
create or replace package body statistics_pkg isprocedure Expired_domain(
  staffId       VARCHAR2,
  timeUnits     VARCHAR2,
  rows      out ResultRows

is
  timeUnit VARCHAR2(10) := to_char(add_months(sysdate,2), 'yyyy-MM-dd');
begin
  if timeUnits is not null then
    timeUnit := timeUnits;
  end if;  open rows for
  select *
  from   domain d
  where  d.staff_id = staffId
         and to_char(d.exp_date, 'yyyy-MM-dd') > to_char(sysdate - 1, 'yyyy-MM-dd')
         and to_char(d.exp_date, 'yyyy-MM') < timeUnit
  order by to_char(d.reg_date, 'yyyy-MM-dd') desc;
end Expired_domain;
end statistics_pkg;ibatis的配置里面定义 
<sqlMap namespace="STATISTICS" >  <parameterMap id="Expired_domain_Parameter" class="java.util.Hashtable">
    <parameter property="staffId"   jdbcType="VARCHAR"      javaType="java.lang.String"   mode="IN" />
    <parameter property="timeUnits" jdbcType="VARCHAR"      javaType="java.lang.String"   mode="IN" />
    <parameter property="result"    jdbcType="ORACLECURSOR" javaType="java.sql.ResultSet" mode="OUT" resultMap="DOMAIN.abatorgenerated_DomainResult" />
  </parameterMap>  <select id="Expired_domain" parameterMap="Expired_domain_Parameter">
    {call STATISTICS_PKG.Expired_domain(?, ?, ?)}
  </select>
</sqlMap>java代码:
         Hashtable<String, Object> paramter = new Hashtable<String, Object>();
        paramter.put("staffId",   staffId);
        paramter.put("timeUnits", timeUnits);        getSqlMapClientTemplate().queryForObject("STATISTICS.Expired_domain", paramter);
        List<Domain> domains = (List<Domain>)paramter.get("result");

解决方案 »

  1.   


    不好意思  忘记了说错误信息SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [17041]; --- The error occurred in com/aspire/dns /oracle_statistics_SqlMap.xml. --- The error occurred while applying a parameter map. --- Check the STATISTICS.Expired_domain_Parameter. --- Check the statement (query failed). --- Cause: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 3; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/aspire/dns /oracle_statistics_SqlMap.xml. --- The error occurred while applying a parameter map. --- Check the STATISTICS.Expired_domain_Parameter. --- Check the statement (query failed). --- Cause: java.sql.SQLException: 索引中丢失 IN 或 OUT 参数:: 3 
      

  2.   

    java.sql.SQLException: 索引中丢失 IN 或 OUT 参数 
    是不是你的iBATIS的调用存储过程的语句写错了啊.
      

  3.   

    另外 在Console里面有信息:11:25:25,656 INFO  [STDOUT] 11:25:25,656 DEBUG [ConfigurationManager] Checking ConfigurationProviders for reload.
    11:25:25,687 INFO  [STDOUT] 11:25:25,687 DEBUG [ConfigurationManager] Checking ConfigurationProviders for reload.
    11:25:25,750 INFO  [STDOUT] 11:25:25,750 DEBUG [InstantiatingNullHandler] Entering nullPropertyValue [target=[com.opensymphony.xwork2.DefaultTextProvider@1fee11], property=struts]
    11:25:25,750 INFO  [STDOUT] 11:25:25,750 DEBUG [ConfigurationManager] Checking ConfigurationProviders for reload.
    11:25:25,750 INFO  [STDOUT] 11:25:25,750 DEBUG [DefaultActionProxy] Creating an DefaultActionProxy for namespace /statistics and action name expired_domain
    11:25:25,781 INFO  [STDOUT] 11:25:25,781 DEBUG [DefaultListableBeanFactory] No bean named 'com.aspire.dns.action.StatisticsAction' found in org.springframework.beans.factory.support.DefaultListableBeanFactory@5c9ab5: defining beans [propertyConfigurer_dns,dataSource_dns,sqlMapClient_dns,txManager_dns,txAdvice_dns,org.springframework.aop.config.internalAutoProxyCreator,service_Option_dns,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor,message,page,domain,contact,message_dao_dns,domainDao,contactDao,statisticsDao,message_service_dns,domainService,contactService,statisticsService,registerService,sec_domain_dns,sec_domain_dao_dns,sec_domain_service_dns]; root of factory hierarchy
    11:25:25,781 INFO  [STDOUT] 11:25:25,781 DEBUG [CollectionFactory] Creating [java.util.LinkedHashMap]
    11:25:25,781 INFO  [STDOUT] 11:25:25,781 DEBUG [CachedIntrospectionResults] Getting BeanInfo for class [com.aspire.dns.action.StatisticsAction]
    11:25:25,812 INFO  [STDOUT] 11:25:25,796 DEBUG [CachedIntrospectionResults] Caching PropertyDescriptors for class [com.aspire.dns.action.StatisticsAction]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'actionErrors' of type [java.util.Collection]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'actionMessages' of type [java.util.Collection]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'class' of type [java.lang.Class]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'context' of type [com.opensymphony.xwork2.ActionContext]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'department' of type [java.lang.String]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'domains' of type [java.util.List]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'endDate' of type [java.lang.String]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'errorMessages' of type [java.util.Collection]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'errors' of type [java.util.Map]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'fieldErrors' of type [java.util.Map]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'ids' of type [java.lang.String]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'idsArray' of type [[Ljava.lang.String;]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'locale' of type [java.util.Locale]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'msg' of type [java.util.List]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'request' of type [javax.servlet.http.HttpServletRequest]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'response' of type [javax.servlet.http.HttpServletResponse]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'resultList' of type [java.util.List]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'session' of type [java.util.Map]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'staffId' of type [java.lang.String]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'staffName' of type [java.lang.String]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'startDate' of type [java.lang.String]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'statisticsService' of type [com.aspire.dns.service.StatisticsService]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'texts' of type [java.util.ResourceBundle]
    11:25:25,812 INFO  [STDOUT] 11:25:25,812 DEBUG [CachedIntrospectionResults] Found bean property 'valueStack' of type [com.opensymphony.xwork2.util.ValueStack]
      

  4.   

    <select  这个标签改成  <procedure