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