Subject Re: Strange behavior in stored procedure
Author vladman992000
--- In, Helen Borrie <helebor@...> wrote:

> The problem here is that there is only one row output from SELECT
> FIRST so your FOR loop is going to return zilch whenever the output
> has multiple rows. Don't use SELECT FIRST in PSQL! Even when it
> returns the "expected" result, it's unnecessarily noisy. PSQL can
> get your one row (or any n rows) much more efficiently:

Thanks Helen. I've modified the SP accordingly.