Diego,
may be you check out the following:
- cursor: DECLARE CURSOR FOR 'SELECT ... FROM ...'
then you can fetch the results and moe within your cursor and do your logic
for each result found, can be hold over transaction scope.
- temporary tables: DECLARE GLOBAL TEMPORARY TABLE ...
a temp table which exists within one transaction
- MQT (materialized query table): CREATE TABLE ... AS 'SELECT .. FROM...'
DATA INITIALLY DEFERRED REFRESH IMMEDIATE ...
this calculated table actually does physically exist and will be used when a
user issues a join which is specified in the FROM clause of the SELECT
statement, it can also be accessed directly, just as you declare it.
Refreshing on request or automated possible
choose what is best for you, a MQT is probably best to reuse.
But, if you have to query just once, may be you open a cursor and for each
item you fetch do your processing ?
Hope that helps
Juliane
gordongekko wrote:
Hi!
I'm writing a program that interacts with a db2 database through jdbc.
I frequently need to run a quite query q1 that involves several full
outer join of a table with itself. Once q1 is executed I need to
postprocess the result. This postprocessing involves several queries on
the result of q1. I think that the best solution would be to
materialize the result of q1 in the database. How can I do it?
Thanks a lot in advance!
Diego
--
Message posted via
http://www.dbmonster.com