I gather a large list of products into an array that name a unique product by line and item. Then I feed that to my SQL statement’s WHERE clause. When this list of products gets rather large my WHERE clause also expands to an ugly mess. So an example of what my WHERE clause can look like is below:
WHERE FOO = 'Y'
AND ((iline = ? AND iitem = ? )
OR (iline = ? AND iitem = ? )
OR ...
OR (iline = ? AND iitem = ? ))
And so on, where each “iline = ? AND iitem = ?” are a unique product. It’s apparent I am no expert at this, but it seems like having the occasional 100+ ORs in my WHERE clause is not very efficient and I could be doing it better somehow.
Thanks.
I doubt it is any more efficient, but you could use a case statement instead: