"Abraham, Danny" <danny_abraham(at)bmc(dot)com> writes:
> stmt := 'select count(*) from ' || table_name;
> open C1 for execute stmt;
> fetch C1 into rc;
> close C1;
> ...
That still isn't a self-contained example; perhaps more usefully,
you've not told us exactly what error you're seeing, either.
FWIW, I tried executing a fragment like the above in a loop,
and it seemed fine.
regards, tom lane