db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <rick.hille...@gmail.com>
Subject Re: Tree view in Derby Stored Procedure
Date Fri, 10 Apr 2015 19:51:29 GMT
On 4/10/15 6:20 AM, BalNagendra wrote:
> Dear All,
> I am attempting to write s Stored Procedure in Derby similar to Oracle
> CONNECT BY/START WITH. CONNECT BY/START WITH builds a hierarchical data set
> from a EMP and MGR self-referencing. I am able to successfully implement
> this using Java but it sits outside Derby. A Derby Stored Procedure would
> sit within Derby database and would extend its features.
> The problem which I am facing is the java.sql.Statement.executeQuery returns
> a RESULTSET. RESULTSET is a cursor. I want to use the result of query as
> search for next query. It is a recursive query. RESULTSET being a cursor is
> not allowing to store multiple results. In other words when I am passing
> current RESULTSET as parameter to another query, the original RESULTSET is
> initialized and it is lost. So, recursive query does not work.
> Is there any way to return the executeQuery other than RESULTSET. I would
> not mind a JSON because it stores simple rows and columns and it does not
> have any associated methods of RESULTSET like NEXT etc.
> But even XML would do.
> Or any alternatives to accessing database? I want only to SELECT the
> database. No other DML features like INSERT, UPDATE or DELETE would be used.
> thanks and regards
> Bala Nagendra
> --
> View this message in context: http://apache-database.10148.n7.nabble.com/Tree-view-in-Derby-Stored-Procedure-tp143909.html
> Sent from the Apache Derby Users mailing list archive at Nabble.com.
A Derby table function might solve your problem. Please see the section 
on table functions in the Derby Developer's Guide: 

Hope this helps,

View raw message