Subject Re: [firebird-support] Clear Resultset of a Stored Procedure
Author Nick Upson
by 'last' I assume you mean the highest value of ID

so in your SP determine the last record to ignore in one loop then do
your actual retruning data select loop that only returns the records
with an ID greater than the ID you determined in the first loop


On 06 Mar 2007 04:17:55 -0800, Matze <mailinglist@...> wrote:
> Hi Firebird-Folks ;-)
>
> I hava a Problem: I have to create a sort of a account in my Database.
> The table looks like this:
> ID User_id Text Amount
> 1 1 test 5
> 2 1 test2 3
> 3 1 test3 -8
> 4 1 test 10
>
> I want to create a stored Procedure, which creates an output of this
> account since the last amount sum of 0.
> To explain that:
> The result of this example shoult be 10, because the result should begin
> after the last line of 0 and 5+3+8=0.
> How can I do this?
> My Idea was, to sum up the amount in a loop and if the sum reaches 0
> clear the output dataset, but I dont know how.