ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anta <antan...@gmail.com>
Subject Calling oracle procedure from Java using iBatis
Date Wed, 26 Aug 2009 09:34:40 GMT


Hi All,

I have a stored procedure as like below in oracle db


create or replace PROCEDURE employee_to_delete (i_condition VARCHAR2)
   IS
      TYPE r_cursor IS REF CURSOR;

      actiontype                    VARCHAR2 (20)         := 'DELETING';
      del_cur_temp                  r_cursor;
      cursor_table                  employee%ROWTYPE;
      sql_stmt                      VARCHAR2 (10000);
   BEGIN
     
      sql_stmt := 'select *  from employee ' || i_condition;

      OPEN del_cur_temp FOR sql_stmt;

      LOOP
         FETCH del_cur_temp
          INTO cursor_table;

         DELETE FROM employee
               WHERE name = cursor_table.name
                 AND no = cursor_table.no
                 AND dept = cursor_table.dept;

         EXIT WHEN del_cur_temp%NOTFOUND;
      END LOOP;
      commit;
   END;


I have add the following line in my sql map file

             
		
	

And I tried to execute the same using the following java code

String str= "pavan";
		sqlMap.queryForObject("deleteUser",str);


The records are deleted successfully. After that I am getting the exception
like below.

Exception in thread "main"
com.ibatis.common.jdbc.exception.NestedSQLException:   
--- The error occurred in SqlMap.xml.  
--- The error occurred while applying a parameter map.  
--- Check the deleteUser-InlineParameterMap.  
--- Check the output parameters.  
--- Cause: java.lang.ArrayIndexOutOfBoundsException: 0
	at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:204)
	at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
	at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
	at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
	at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82)
	at Main.main(Main.java:16)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
	at
com.ibatis.sqlmap.engine.exchange.PrimitiveDataExchange.setData(PrimitiveDataExchange.java:51)
	at
com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap.refreshParameterObjectValues(ParameterMap.java:141)
	at
com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.postProcessParameterObject(ProcedureStatement.java:26)
	at
com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:193)
	... 6 more

Please any one explain me why this exception occurs also how to solve it.

Thanks in Advance
Ant

-- 
View this message in context: http://www.nabble.com/Calling-oracle-procedure-from-Java-using-iBatis-tp25149496p25149496.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.

Mime
View raw message