I have a very complex logic stream where I need to read in detail data, filter it, and then count, sum, or further filter based on values in certain columns of a "rules" record in another table. This cannot be done in a single pass and since it is dynamic, I cannot use a static view. My initial thought was to retrieve the detail data from a pipelined function so that further "selects" can be performed.
1) Is this the best approach?
2) How would I write the pipelined function? The only examples I see do not "select" from a table.