ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moorthy GT <gtmoor...@moorthyhome.com>
Subject Re: How to run a stored procedure with iBATIS.
Date Wed, 21 Oct 2009 23:47:24 GMT

Check this out for a sample

http://www.moorthyhome.com/blog/entry/ibatis_oracle_stored_procedure
http://www.moorthyhome.com/blog/entry/ibatis_oracle_stored_procedure 




Fabiano Ferrari wrote:
> 
> Hi, all.
> 
> I need some help to run a stored procedure with iBATIS. Sorry if this
> question has already circulated in list.
> 
> When trying to run the procedure, I run into a problem. My database is
> Oracle 10g Express Edition and I'm currently using iBATIS 2.0 Beta 4.
> 
> This is the output I get when invoking the procedure within a JUnit test
> case:
> 
>   1)
> testExecuteQueryProcedure(com.ibatis.sqlmap.engine.execution.SqlExecutorTest)com.ibatis.common.jdbc.exception.NestedSQLException:
>   --- The error occurred in
> com/ibatis/sqlmap/maps/OracleProc-modified.xml.
>   --- The error occurred while applying a parameter map.
>   --- Check the getAccountEmail.
>   --- Check the parameter mapping for the 'email' property.
>   --- Cause: java.sql.SQLException: Cannot perform fetch on a PLSQL
> statement: next
> 
> 
> -------------------------------------------------
> 
> My JavaCode is:
> 
>   Map param = new HashMap();
>   param.put("id",    new Integer(1));
>   param.put("email", new String());
> 
>   String email = (String) sqlMap.queryForObject(
> "getAccountEmailViaProcedure", param);
> 
> 
> 
> My SqlMap is:
> 
>   <parameterMap id="getAccountEmail" class="map" >
>     <parameter property="id"    jdbcType="INTEGER"
> javaType="java.lang.Integer" mode="INOUT"/>
>     <parameter property="email" jdbcType="VARCHAR"
> javaType="java.lang.String"  mode="OUT"/>
>   </parameterMap>
> 
>   <procedure id="getAccountEmailViaProcedure"
> parameterMap="getAccountEmail">
>      {call get_account_email ( ? ,? )}
>   </procedure>
> 
> 
> My Oracle procedure (which works fine when manually invoked) is:
> 
>   PROCEDURE get_account_email
>     (id IN INTEGER, email OUT VARCHAR)
>   IS
>   BEGIN
>     SELECT acc_email
>     INTO email
>     FROM account2
>     where ACC_ID = id;
>   END;
> 
> -------------------------------------------------
> 
> Thanks for any help.
> 
>   Fabiano
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-run-a-stored-procedure-with-iBATIS.-tp19081003p26002021.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


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


Mime
View raw message