build a 'temp' table, and union them in one or 10 at a time, then do
your work against the temp table.
will take a little work to make the whole mess re-entrant, but can be
done by creating the temp table name as unique and passing its name
around as a variable.