ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Jenkins <krisajenk...@yahoo.co.uk>
Subject Re: Calling Oracle Stored Functions:
Date Fri, 17 Dec 2004 10:06:40 GMT
The easiest way is to just put it in a select statement:

<select parameterClass="java.lang.String" resultClass="java.lang.Integer">
    select myfunc( #someVal# ) from dual
</select>

This will work if and only if the function has no DML statements.

HTH,
Kris


Robert Dare wrote:

>>From JDBC I can call the function using a CallableStatement.
>
>...Yes, I am currently creating a StoredProcedure which simply
>calls the function and returns the value.
>
>
>
>  
>
>>-----Original Message-----
>>From: Larry Meadors [mailto:Larry.Meadors@plumcreek.com] 
>>Sent: Thursday, December 16, 2004 3:27 PM
>>To: Robert Dare; ibatis-user-java@incubator.apache.org
>>Subject: Re: Calling Oracle Stored Functions:
>>
>>
>>How do you call them from JDBC directly?
>>
>>Can you call the function from a procedure in oracle? There 
>>may be an easier way, but it seems like this would be an 
>>immediate option for you.
>>
>>Larry
>>
>>    
>>
>>>>>"Robert Dare" <rdare@comerxia.com> 12/16/04 1:07 PM >>>
>>>>>          
>>>>>
>>Hi All,
>>
>>Is there a way to call Oracle functions (not stored 
>>procedures) from iBATIS?
>>
>>I have iBATIS and Oracle Stored Procedures working without 
>>issue on Oracle 8i.  I have to support some Legacy procedures 
>>that are written as Oracle stored functions.  
>>
>>When I tried accessing these functions as stored procedures, I 
>>got an Oracle invalid SQL exceptions:  (tried this with a 
>>parameterMap, and parameter class with inline mapping with
>>same results):
>>
>>    <procedure id="confirmOrder" parameterMap="confirmation_params"
>>               resultClass="java.lang.Long" >
>>        { ?=call porders.createconfirmation (?,?,?)} 
>>    </procedure>
>>
>>
>>I tried accessing the function like this:
>>
>>    <statement id="confirmOrderStmt"  
>>               parameterClass="OrderConfirmation"
>>               resultClass="java.lang.Long">
>>        [CDATA[ 
>>            begin
>>            ? := porders.createconfirmation (
>>                #orderId#,
>>                #vendorId#,
>>                #vendorOrderId#); 
>>            end;
>>        ]]
>>    </statement>
>>
>>The above fails, Oracle complains about unbound parameters. 
>>Changing the ? to #confirmationId# (a field in the 
>>resultClass), results in an "invalid column type" sql 
>>exception.  I also tried some inline mapping as in 
>>#confirmationId:mode=OUT#, but that didn't help.
>>
>>Regards,
>>
>>Rob.
>>
>>
>>
>>    
>>
>
>  
>


-- 
Kris Jenkins
Email:  kris@jenkster.com
Blog:   http://cafe.jenkster.com/
Wiki:   http://wiki.jenkster.com/


Mime
View raw message