Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL from Java

Re: PL/SQL from Java

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 4 Aug 2001 16:25:40 -0700
Message-ID: <9ki09k03h9@drn.newsguy.com>

In article <9k9g3g$3d2j0$1_at_ID-73468.news.dfncis.de>, "David says...
>
>ok, bad i have this pl/sql procedure
> function prihlasenie_elm (icLogin varchar2,
> icPassword varchar2,
> ocSID OUT varchar2,
> onErrProtId OUT NUMBER) return boolean;
>
>I call this procedure from java
> CallableStatement cstmt = dbConn.prepareCall("{? = call
>s_k_prihlasenie.prihlasenie_elm(?, ?, ?, ?)}");
> cstmt.setString(2,login);
> cstmt.setString(3,password);
> cstmt.registerOutParameter(1,Types.INTEGER); //i don't know which type
>i must write here????
> cstmt.registerOutParameter(4,Types.VARCHAR);
> cstmt.registerOutParameter(5,Types.NUMERIC);
>
>Thanks for your help.
> David
>

cannot bind to a PLSQL boolean using a 3gl. You can do something like this:

declare

   l_result number default 0;
begin

   if ( s_k_prihlasenie.prihlasenie_elm(?, ?, ?, ?) )    then

       l_result := 1;
   end if;
   ? := l_result
end;

and use that as your callable statement. It'll be parameter 5 that is bound as an OUT parameter now, not parameter 1.

>

--
Thomas Kyte (tkyte@us.oracle.com)             http://asktom.oracle.com/ 
Expert one on one Oracle, programming techniques and solutions for Oracle.
http://www.amazon.com/exec/obidos/ASIN/1861004826/  
Opinions are mine and do not necessarily reflect those of Oracle Corp 
Received on Sat Aug 04 2001 - 18:25:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US