So i have a list of like 300 strings.
I wanted to iterate through this list and run a SELECT
statement with each string.
Example:
theList = ['account1', 'account2', 'account3']
for eachItem in theList:
SELECT * from aTable where accountName = eachItem
An important note here is, I cannot INSERT
or CREATE
a table in this DB as this is a production database.
And the list of 300 strings, is a part of a column accountName
with 50,000 entries.
This is what i was trying, couldnt figure out how to make it work:
DECLARE
theaccount varchar(100);
BEGIN
FOR theaccount in ['account1','account2'] LOOP
(
select *
from aTable
where
accountName = theaccount
);
END LOOP;
END;