ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Turkenkopf <dturk...@gmail.com>
Subject Re: Calling oracle procedure from Java using iBatis
Date Wed, 26 Aug 2009 19:26:59 GMT
Hi Ant,

I'm not tremendously familiar with PL/SQL stored procedures, but it doesn't
look like you're returning anything from yours.

I think what's happening is the queryForObject method is looking for a
return parameter and not finding anything.

If the procedure really doesn't need to return anything, try invoking it
with the update method instead of the queryForObject.

On Wed, Aug 26, 2009 at 5:34 AM, Anta <antany84@gmail.com> wrote:

> 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: Calling oracle procedure from Java using
> iBatis<http://www.nabble.com/Calling-oracle-procedure-from-Java-using-iBatis-tp25149495p25149495.html>
> Sent from the iBATIS - User - Java mailing list archive<http://www.nabble.com/iBATIS---User---Java-f370.html>at
Nabble.com.
>

Mime
View raw message