By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
SELECT x,y,z FROM table1 WHERE conditions on table1 columns LOOP... FETCH set HOST-VAR = table1.x SELECT a,b,c FROM table2 WHERE table2.a = HOST-VAR AND table2 conditions END LOOPChange the above to something like this:
SELECT x,y,z,a,b,c FROM table1, table2 WHERE x = a AND table1 conditions AND table2 conditionsThat will perform much better. If there are circumstances where there are no rows in table2 that will match table1, then you will need to change this join into an outer join.
Dig Deeper on IBM DB2 management
Related Q&A from Craig S. Mullins
Our expert suggests that the best way to pass the SAP BW exam is to have hands-on job experience. But that's not all he has to say about ...continue reading
To export data from a DB2 table to a flat file, you need to run an export specifying the proper file format. The export utility exports data from a ...continue reading
Craig Mullins recommends two specific resources for learning how to create and support Binary Large Objects (BLOB) in DB2.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.