How can I get the value of a second parameter from a Java Class? This Example from the documentation works. public class Invoice { public static boolean testOut( int[] param ) { param[0] = 123; return true; } } CREATE PROCEDURE testOut( OUT p INTEGER ) EXTERNAL NAME 'Invoice.testOut([I)Z' LANGUAGE JAVA; What I'm looking for is something like this: public static boolean testOut( int[] param ) { param[0] = 123; **param[1] = 444;** return true; } I'm stuck with the declaration of the Procedure. Thanks! |
You cannot do what you want with JAVA stored procedures. If you look at the procedure declaration, there are two parts - the SQL wrapper definition and the JAVA signature. In your example, the SQL wrapper is: testOut( Out p INTEGER ) and the JAVA signature is: Invoice.testOut([I)Z The problem is that there is no way to declare an array of OUT SQL integers in the SQL wrapper portion. You will therefore have to do something like: CREATE PROCEDURE testOutMany( OUT p0 INTEGER, OUT p1 INTEGER, OUT p2 INTEGER ) EXTERNAL NAME 'Invoice.testOutMany([I[I[I)Z' LANGUAGE JAVA public static boolean testOutMany(int[] param0, int[] param1, int[] param2 ) { param0[0] = 123; param1[0] = 444; param2[0] = 567; return true; } |