Our programs has an input file and based on the data in input file, it selects data from a table. Select query program runs is same and only change is the key used in where clause.
select col1, col2, col3 from tableName where keycol = :b1
In that case, why not reference the input as an external table, and then the operation would be:
select col1, col2, col3 from tableName where keycol in
( select val from my_external_table );
and you would collect all the data in one query pass