DB2 V9.x doesn't like it...
The standard recursive select works, but is an update also
possible.. ?
Based on this example...
WITH RPL (ID, PART, SUBPART, QUANTITY) AS
( SELECT ROOT.ID, ROOT.PART, ROOT.SUBPART, ROOT.QUANTITY
FROM PARTLIST ROOT
WHERE ROOT.PART = '01'
UNION ALL
SELECT CHILD.ID, CHILD.PART, CHILD.SUBPART, CHILD.QUANTITY
FROM RPL PARENT, PARTLIST CHILD
WHERE PARENT.SUBPART = CHILD.PART
)
SELECT DISTINCT PART, SUBPART, QUANTITY
FROM RPL
ORDER BY PART, SUBPART, QUANTITY
I would like to do this ...
WITH RPL (etc etc ...
.PART)
UPDATE OTHERTABLE O SET COLUMNA = X WHERE O.LINKID in (SELECT ID from
RPL)
So replace the final select with an update statement that uses results
of the recursive query.
thanks in advance for any pointers.
Voila :-)
Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May I suggest that the sequel to your "SQL On Fire!" should be named "SQL
From Hell!" ?... ;-)
--
Jeroen