Thanks for Reply..

After a hour of debugging I resolved the issue by removing the
"parameterClass" attribute from the procedure element in sqlmap. Then it
works fine.

Once again thanks for your replies

Regards,
Ant


Anta wrote:
> 
> <PRE>
> 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
> 
>              <procedure id="deleteUser" parameterClass="string">
>               <![CDATA[ {call employee_to_delete('where name like '' 
> $value$'')} ]]>
>       </procedure>
> 
> 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
> </PRE>
> 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to