ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pei allen <allenpei0...@hotmail.com>
Subject RE: How to call procedure in oracle package using IBatis.Net.
Date Fri, 21 Sep 2007 12:47:34 GMT

Dear all,
The prodedure with no package,like below (it runs ok!):
********************************************************
CREATE OR REPLACE PROCEDURE allen_test (i_input in number,o_result out number) IS   v_seq
                 NUMBER;                BEGIN        o_result := i_input;    return;END allen_test;
**************************************
<procedure id="ProcedureTest" parameterMap="ProcedureTestMap" >        ALLEN_TEST  
   </procedure> parameterMap id="ProcedureTestMap" class="Hashtable">        <parameter
property="input" column="i_input" dbType="integer" direction="Input" />        <parameter
property="result" column="o_result" dbType="integer" direction="Output" />      </parameterMap>
****************************************
public long ProcedureTest()        {            Hashtable ht = new Hashtable();          
 ht["input"] = 1;            ht["result"] = 0;            m_DaoFacade.QueryForObject<Hashtable>("ProcedureTest",
ht);
            return Convert.ToInt32(ht["result"]);        }        #endregion
**********************************************
 
So please help how to call procedure in oracle package using IBatis.Net.
 
Thanks very much!
allen
2007.9.21



From: allenpei0805@hotmail.comTo: user-cs@ibatis.apache.orgSubject: RE: How to call procedure
in oracle package using IBatis.Net.Date: Fri, 21 Sep 2007 20:32:17 +0800


Dear all,       my whole sqlmap:   <?xml version="1.0" encoding="utf-8" ?><sqlMap
namespace="CommonBase" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <statements>      <procedure id="ProcedureTestPkg" parameterMap="ProcedureTestMapPkg"
>        ALLEN_PKG.ALLEN_TEST      </procedure>            </statements>  
 <parameterMaps>      <parameterMap id="ProcedureTestMapPkg" class="Hashtable">
       <parameter property="input" column="i_input" dbType="integer" direction="Input"
/>        <parameter property="result" column="o_result" dbType="integer" direction="Output"
/>      </parameterMap>    </parameterMaps></sqlMap>*******************************************
   SqlMapConfig like below database node, the othe node is like the standard config:<database>
<provider name="OleDb1.1"/>    <dataSource name="darwine_test" connectionString="Provider=OraOLEDB.Oracle.1;Password=oracle;Persist
Security Info=True;User ID=rddarwine;Data 
 Source=darwine_rd"/></database> I only know "Queryforobject","Queryforlist",  any
other?but with this config,i can call the procedure successfully if this procedure not in
package,but in oracle, i don't konw why? like below:<procedure id="ProcedureTest" parameterMap="ProcedureTestMap"
>        ALLEN_TEST      </procedure> parameterMap id="ProcedureTestMap" class="Hashtable">
       <parameter property="input" column="i_input" dbType="integer" direction="Input"
/>        <parameter property="result" column="o_result" dbType="integer" direction="Output"
/>      </parameterMap>Thanks!2007.9.21> Subject: RE: How to call procedure in
oracle package using IBatis.Net.> Date: Fri, 21 Sep 2007 08:15:55 -0400> From: Samuel_Clough@princetonrg.com>
To: user-cs@ibatis.apache.org> > I think we need to see more of your sql map. All I
see is your> procedure name, and we need to see the xml node that the call is defined>
in.> > I'm also not sure you're using the correct call. Unless there's 
 an> attribute I'm not aware of, Queryforobject is to read an object from a> result
set, not load it from an input/output parameter.> > -----Original Message-----> From:
pei allen [mailto:allenpei0805@hotmail.com] > Sent: Friday, September 21, 2007 8:10 AM>
To: user-cs@ibatis.apache.org> Subject: How to call procedure in oracle package using IBatis.Net.>
> > Dear all,> when i call procedure in oracle package using IBatisNet, it always>
failed.> I can call oracle procedre using IBatisNet successfully,but to> package 's
procedure, it dosen't work.> The code like this:> > Oracle's Package like below:>
**************************************> CREATE OR REPLACE > PACKAGE allen_pkg> IS>
> PROCEDURE ALLEN_TEST (i_input in number,o_result out number) ;> END;> /> CREATE
OR REPLACE > PACKAGE BODY allen_pkg> IS> PROCEDURE ALLEN_TEST (i_input in number,o_result
out number) > IS > v_seq NUMBER; > BEGIN > o_result := i_input;> return;>
END ALLEN_TEST;> > END allen_pkg;> ********************
 *******************> > The SqlMap like below:> *****************************************************>
> > ALLEN_PKG.ALLEN_TEST> > > > > > > > > ******************************************************>
> The Calling function like below:> *****************************************************>
public long ProcedureTest()> {> Hashtable ht = new Hashtable();> ht["input"] = 1;>
ht["result"] = 0;> m_DaoFacade.QueryForObject("ProcedureTestPkg", ht);> > return
Convert.ToInt32(ht["result"]);> }> ********************************************************>
> when run to "m_DaoFacade.QueryForObject("ProcedureTestPkg", ht);", an> exception was
thrown like below:> "PLS-00306: wrong number or types of arguments ......"> > I use
Oracle 10gR2, VS2005 C#, IBatisNet.DataMapper(1.5.1.0)> > Thanks!> 2007.9.21>
> > > > _________________________________________________________________>
Invite your mail contacts to join your friends list with Windows Live> Spaces. It's easy!>
http://spaces.live.com/spa
 cesapi.aspx?wx_action=create&wx_url=/friends.a> spx&mkt=en-us > -------------------------------------------------------->
> Princeton Retirement Group, Inc - Important Terms > This E-mail is not intended for
distribution to, or use by, any person or entity in any location where such distribution or
use would be contrary to law or regulation, or which would subject Princeton Retirement Group,
Inc. or any affiliate to any registration requirement within such location. > This E-mail
may contain privileged or confidential information or may otherwise be protected by work product
immunity or other legal rules. No confidentiality or privilege is waived or lost by any mistransmission.
Access, copying or re-use of information by non-intended or non-authorized recipients is prohibited.
If you are not an intended recipient of this E-mail, please notify the sender, delete it and
do not read, act upon, print, disclose, copy, retain or redistribute any portion of this E-mail.
> The trans
 mission and content of this E-mail cannot be guaranteed to be secure or error-free. Therefore,
we cannot represent that the information in this E-mail is complete, accurate, uncorrupted,
timely or free of viruses, and Princeton Retirement Group, Inc. cannot accept any liability
for E-mails that have been altered in the course of delivery. Princeton Retirement Group,
Inc. reserves the right to monitor, review and retain all electronic communications, including
E-mail, traveling through its networks and systems (subject to and in accordance with local
laws). If any of your details are incorrect or if you no longer wish to receive mailings such
as this by E-mail please contact the sender by reply E-mail. > > --------------------------------------------------------

Discover the new Windows Vista Learn more! 
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE
Mime
View raw message