declare msql varchar2(200); row_id varchar2(200); begin loop row_id := 'AAATGiAAEAAAuLLAAA'; msql := 'select * from t3 where rowid='''||row_id || ''''; execute immediate msql; end loop; end; declare msql varchar2(200); id NUMBER; begin loop id := 90; msql := 'select * from t3 where id='||id; execute immediate msql; end loop; end;