SQL table iteration

SQL table iteration

 

  

Hi all -

It seems to me that there isn't the option to use FOR EACH or IF style
loops with DB2 SQL. Is there some other way to iterate through a table
to work on another? This pseudocode is the kind of thing I'm talking about:

FOR EACH i in TABLE1
UPDATE TABLE2
SET TABLE2.COLUMN2 = 'foo'
WHERE TABLE2.COLUMN1 > TABLE1.COLUMN1
END FOR

It seems so obvious, but I just don't see that DB2 functionality? Please
let me know.
Thanks.

JG


DB2 & UDB email list listserv db2-l LazyDBA home page