db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: Problem with getting the return value out of my stored procedure
Date Mon, 21 Apr 2008 07:09:42 GMT
"Hammonds, Nicholas" <Nicholas.Hammonds@thus.net> writes:

> Hi,
> I'm creating a stored derby with the following code
>
> ====== 
> String sql =
>             "CREATE PROCEDURE testproc(" +
>                     "IN S_YEAR INTEGER, OUT RETTOT INTEGER) " + 
>                     "PARAMETER STYLE JAVA CONTAINS SQL LANGUAGE JAVA
> EXTERNAL NAME " +
>                     "'net.thus.unittest.StoredProcStuff.javaTestProc'";
>         
>         
>           Statement  stat = con.createStatement();
>             stat.execute(sql);
>
> ========
>
> The matching java method 
>
> =========
> public static void javaTestProc(int a, int[] b ) {
>         System.out.println("paramOne is " + a);
>     }
> ==========
>
> I can call the procedure fine and see that I am able to pass the
> parameter in, although I don't have a clue how to get a return value
> out.

Hi Nicholas,

To get the return value out, you'll need to assign a value to b[0], like
this:

  b[0] = 42;

-- 
Knut Anders

Mime
View raw message