File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes querying against Result Sets. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "querying against Result Sets." Watch "querying against Result Sets." New topic
Author

querying against Result Sets.

Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
Is it possible to run a query against a resultSet? As opposed to getting a resultSet, creating a new table, and then querying against that or creating a new query from two?

I have to write code that will allow a user to create as series queries each one run against the previous queries results (so that the queries are against progressively smaller and smaller data sets).

If it makes any difference I'm using HSQLDB.

-Tad
Tad Dicks
Ranch Hand

Joined: Nov 16, 2004
Posts: 264
Having looked around I'm guessing the thing to do would be to create "views."

This may be a relatively basic question... but when you create a view, how long does it persist(permanently, until you close the connection)? if you create a view how widely available is it (only to the connection that created it or any connection?) If they persist, do you dispose of them the same way you would a table?


-Tad
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26173
    
  66

Originally posted by Tad Dicks:
Is it possible to run a query against a resultSet? As opposed to getting a resultSet, creating a new table, and then querying against that or creating a new query from two?

No. You would need to use a temp table, materialized view or do the query again and use a join.

when you create a view, how long does it persist(permanently, until you close the connection)? if you create a view how widely available is it (only to the connection that created it or any connection?) If they persist, do you dispose of them the same way you would a table?

If you are using a materialized view (available in Oracle) the view is persisted. Take a look at this article for more details on materialized views. It is available to any connection as it resides on the database. The availability depends on the settings used when it is created.

A regular view is like a shortcut syntax for a query. It does not save the results at all. The database expands it into the real query at runtime.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: querying against Result Sets.
 
Similar Threads
Which approach is better ?
setting runtime selection criteria in a jsp for crystal reports11 using jrc
Resultset with million rows
Can you use nested sql statements in jsp??
Web Application Design