db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sin(EaTing)," <uss...@gmail.com>
Subject Re: How to return an array of String in a Java routine?
Date Sun, 01 Jun 2008 02:25:26 GMT
Thanks Knut and Johnny!
These information really help!


On Sat, May 31, 2008 at 8:29 PM, Knut Anders Hatlen <Knut.Hatlen@sun.com>
wrote:

> sin(EaTing), wrote:
>
>> Hi,
>>
>> I want to return an array of Strings from a Java routine. How could I
>> create the procedure declaration and definition.
>>
>
> Hi,
>
> Derby doesn't support returning arrays from functions or stored procedures,
> I'm afraid.
>
>  Or if possible could I create my own ResultSet in my Java routine, and
>> manually insert rows into that ResultSet?
>>
>
> Yes, that's possible. You can find an example on the wiki (
> http://wiki.apache.org/db-derby/DerbySQLroutines) that shows how to create
> a Java routine which returns a ResultSet. In the routine, you can return
> your array of strings as a ResultSet by executing a VALUES statement. To
> return the array {"one","two","three"}, you would execute VALUES 'one',
> 'two', 'three'.
>
> If more flexibility is needed, you can take a look at the table functions
> that were added in Derby 10.4. They allow you to use your own implementation
> of the java.sql.ResultSet interface. More details can be found here:
>
> http://db.apache.org/derby/docs/10.4/devguide/cdevspecialtabfuncs.html
> http://db.apache.org/derby/docs/10.4/ref/rrefcreatefunctionstatement.html
>
> --
> Knut Anders
>

Mime
View raw message