Recommendations for Compiling References to Result Sets
Most problems with references to named sets can be alleviated by adhering to the following guidelines:
- Qualify set operations by explicitly giving the set name where possible (e.g., next set1, top set1) rather than letting the software implicitly assume the current set.
- Declare set objects in the database, forcing the software to check the structure of result sets that employ a particular name.
- Always give a set an explicit name.
- Never use the same name for sets whose component structures are different (see Example 4 and Example 5). With SET CHECKSETS ON, the software enforces this recommendation.
- Use the SET CURRENTSET command to specify the result set that is to be the current set in a particular situation.