Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 838 invoked from network); 20 Nov 2006 15:40:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Nov 2006 15:40:08 -0000 Received: (qmail 41636 invoked by uid 500); 20 Nov 2006 15:39:44 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 41569 invoked by uid 500); 20 Nov 2006 15:39:43 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 41558 invoked by uid 99); 20 Nov 2006 15:39:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2006 07:39:43 -0800 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=HTML_MESSAGE,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [83.103.62.70] (HELO mailgateway.ads.it) (83.103.62.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Nov 2006 07:39:26 -0800 Received: from mailgateway.ads.it (unknown [127.0.0.1]) by mailgateway.ads.it (Symantec Mail Security) with ESMTP id 984F2398014 for ; Mon, 20 Nov 2006 16:38:49 +0100 (CET) X-AuditID: 0a61fe14-ae060bb0000019f2-f0-4561cc09ce76 Received: from mail.ads.it (mercurio.finmatica.local [10.97.30.5]) by mailgateway.ads.it (Symantec Mail Security) with ESMTP id 7DC0A42400B for ; Mon, 20 Nov 2006 16:38:49 +0100 (CET) Subject: stored function: NUMBER result, NUMBER IN parameter To: user-java@ibatis.apache.org X-Mailer: Lotus Notes Release 7.0.1 January 17, 2006 Message-ID: From: c.zecca@ads.it Date: Mon, 20 Nov 2006 16:37:22 +0100 X-MIMETrack: Serialize by Router on Mercurio/Minosse(Release 6.5.5|November 30, 2005) at 20/11/2006 16.37.22 MIME-Version: 1.0 Content-type: multipart/alternative; Boundary="0__=4EBBF8BFDFAECDC18f9e8a93df938690918c4EBBF8BFDFAECDC1" Content-Disposition: inline X-Brightmail-Tracker: AAAAAA== X-Virus-Checked: Checked by ClamAV on apache.org --0__=4EBBF8BFDFAECDC18f9e8a93df938690918c4EBBF8BFDFAECDC1 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: quoted-printable The TIPO_DATO_RIGA package declares the following overloaded versions o= f the exists_id() method in its interface function exists_id ( p_tipo_riga_ID in number(10) ) return number; pragma restrict_references( exists_id, WNDS ); function exists_id ( p_tipo_dato_ID in number(10) , p_nome in varchar2(30) ) return number; pragma restrict_references( exists_id, WNDS ); Here is the SQL map {#result,mode=3DOUT,javaType=3Djava.lang.Integer,jdbcType=3DNUM= BER# =3D call tipo_dato_riga.exists_id( #pId ,javaType=3Djava.lang.Integer,jdbcType=3DNUMBER,mode=3DIN# ) } and the Java code that calls it SqlMapClient lSqlMapClient =3D Configurazione.getSqlMapIstanza();= Integer lInteger; HashMap< String, Integer > lHashMap =3D new HashMap< String, Inte= ger >(); lHashMap.put( "pId", new Integer( 1234 ) ); try { lSqlMapClient.update( "esisteTipoRiga", lHashMap ); } catch (SQLException pException) { pException.printStackTrace(); throw pException; } lInteger =3D lHashMap.get( "result" ); boolean lResult =3D lInteger.intValue() =3D=3D 1; causes the following diagnostic --- The error occurred in it/finmatica/gpj/aa/frontebd/TipoRiga.xml. --- The error occurred while executing update procedure. --- Check the {? =3D call tipo_dato_riga.exists_id( ? ) }. --- Check the output parameters (register output parameters failed). --- Cause: java.sql.SQLException: Invalid column type Caused by: java.sql.SQLException: Invalid column type at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpda= te( GeneralStatement.java:91) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.update( SqlMapExecutorDelegate.java:500) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.update( SqlMapSessionImpl.java:85) Please note that the following PL/SQL declare lId number; lResult number; begin lId :=3D 1234; lResult :=3D tipo_dato_riga.exists_id( lId ); dbms_output.put_line( 'here we are...' ); dbms_output.put_line( 'lId =3D ' || lId || ', lResult =3D ' || lResul= t ); end; works fine. What's wrong in the SQL map / java code? Any hint? Is there any simpler approach on the Java side? Thanks in advance= --0__=4EBBF8BFDFAECDC18f9e8a93df938690918c4EBBF8BFDFAECDC1 Content-type: text/html; charset=US-ASCII Content-Disposition: inline Content-transfer-encoding: quoted-printable

The TIPO_DATO_RIGA package declares the following overloaded version= s of the exists_id() metho= d in its interface

   func= tion exists_id
  ( p_tipo_riga_ID  
in numb= er(10)
  )
return number;
 
pragma restrict_references( exists_id, WNDS );

   function exists_id
  ( p_tipo_dato_ID  
in numb= er(10)
  , p_nome          
in
 <= font size=3D"2">varchar2(30)
  )
return number;
 
pragma restrict_references( exists_id, WNDS );


Here is the SQL map

<procedure id=3D"esisteTipoRiga
" p= arameterClass=3D"java.util.Map">
 {#resu= lt,mode=3DOUT,javaType=3Djava.lang= .Integer,jdbcType=3DNUMBER# =3D call tipo_dato_riga.exists_id( #= pId,j= avaType=3Djava.lang.Integer,jdbcType=3DNUMBER,mode=3DIN# ) }

</procedure>  

and the Java code that calls it

SqlMapClient lSqlMapClient =3D Configurazione.get= SqlMapIstanza();
   
    Integer lInteger;
    HashMap< String, Integer > lH= ashMap =3D new HashMap< String, Integer >();
    lHashMap.put( "pId", new = Integer( 1234 ) );
   
        try
        {
        lSqlMapClient.update(= "esisteTipoRiga", lHashMap );
        }
        catch (SQLException pE= xception)
        {
        pException.printStack= Trace();
        throw pException;
        }
    lInteger =3D lHashMap.get( "re= sult" );
       boolean lResult =3D lIn= teger.intValue() =3D=3D 1;

causes the following diagnostic

--- The error occurred in it/fin= matica/gpj/aa/frontebd/TipoRiga.xml.  
--- The error occurred while exe= cuting update procedure.  
--- Check the {<= b>? =3D call tipo_dato_riga.exists_i= d( ? ) }. &= nbsp;
--- Check the output parameters = (register output parameters failed).  
--- Cause: java.sql.SQLException
<= tt>: Invalid column type
=
Caused by: java.sql.SQLException<= tt>: Invalid column type=
at com.ibatis.sqlmap.engine.map= ping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:91)
at com.ibatis.sqlmap.engine.imp= l.SqlMapExecutorDelegate.update(SqlMapExecutorDelegate.java:500)
at com.ibatis.sqlmap.engine.imp= l.SqlMapSessionImpl.update(SqlMapSessionImpl.java:85)

Please note that the following PL/SQL

declare
lId number;
lResult
number;
begin
lId :=3D 1234;
lResult :=3D tipo_dato_riga.exists_id( lId );
dbms_output.put_line(
'here we are...' );
dbms_output.put_line(
'lId =3D ' |= | lId || ', lResult =3D ' || lResu= lt );
end;

works fine.
What's wrong in the SQL map / java code?
Any hint?
Is there any simpler approach on the Java side?

Thanks in advance
= --0__=4EBBF8BFDFAECDC18f9e8a93df938690918c4EBBF8BFDFAECDC1--