Subject Re: [firebird-support] Merging two sets in an SP
Author Vlad Horsun
> I want to scan the two sets, fetching an item from each and deciding
> how they match up. As each is consumed, I need to fetch another one
> of that kind, producing in the end a sum of payments within a given
> period.
>
> This is basically a merge problem, but I don't see a way to do it in
> PSQL because it looks to me like you have to read all of one set
> before you can do anything with the other one.
>
> Does anyone have any suggestions as to how this could be done using
> PSQL? Or SQL for that matter, say with an SP or a UDF in the join
> condition?

Explicit CURSORS in FB2's PSQL may help you

Regards,
Vlad