The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

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!

asked 20 Mar '13, 03:57

Arndt's gravatar image

Arndt
21113
accept rate: 0%

edited 20 Mar '13, 08:35

Mark%20Culp's gravatar image

Mark Culp
22.3k9129262


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;
}
permanent link

answered 20 Mar '13, 08:47

Karim%20Khamis's gravatar image

Karim Khamis
5.6k53870
accept rate: 40%

edited 20 Mar '13, 08:58

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×100
×62
×22

question asked: 20 Mar '13, 03:57

question was seen: 739 times

last updated: 20 Mar '13, 08:58