db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: How to return an array of String in a Java routine?
Date Mon, 02 Jun 2008 12:51:30 GMT

As you note, Derby does not support Array types. If you need to return a 
collection from a SQL routine, the following may help:

1) Transform the collection into a ResultSet. As Knut points out, you 
have two options here:

  a) Write a table function.
  b) Write a ResultSet-returning procedure

2) Alternatively, you can serialize your String[] into a byte array. 
This solution will work any time you need to use SQL routines to pass 
arbitrary objects. The return type of your function would be VARCHAR FOR 
BIT DATA or LONG VARCHAR FOR BIT DATA. That is, you would declare your 
function like this:

  create function MyFunction( ... )
  returns varchar( 32672) for bit data ...

Hope this helps,

sin(EaTing), wrote:
> Thanks.
> I may use String[] in the implement of the Java Routine, but I don't 
> know how to declare the routine. It seems Java Routine in Derby does 
> not support Array types as IN or OUT parameters?

View raw message