Oracle Sql Loop Through Select Statement With Where Clause