Запрос можно выполнить прямо в sqlplus
set serveroutput on;
declare
cnt number;
begin
for c in (select * from all_tables where owner = 'SAPSR3' and table_name like 'Z%') loop
execute immediate 'select count(rownum) into : x from "SAPSR3".'||c.table_name into cnt;
dbms_output.put_line(c.table_name||' cnt = '||cnt);
end loop;
end;
/