Subject Re: [IBO] Running total column
Author Helen Borrie
At 09:40 AM 9/02/2005 +0000, you wrote:

>--- In, Helen Borrie <helebor@t...> wrote:
> > A more useful way is to write a selectable stored procedure that
> > outputs the running total as an actual output field. If you have
> > Firebird Book, you can find an example on pp. 625-627.
> >
> > Take care to write such a SP so that the search parameters you would
> > pass in a WHERE clause to a regular DSQL query are received as input
> > arguments to the SP call.
>Thanks for the reply.
>Actually I already use a stored procedure in exactly the way you
>suggest. However it became a monster because it has to take care of
>parametrized WHERE, ORDER BY, some JOINS and a few other things. And
>it's still not finished... every week I need to add something so it
>gets worse. That's why I was looking for another solution.

Ach, if you have to devise SPs that need to be joined to other things, or
that need WHERE clauses, I'm sad to say you need to revisit the SP with a
well-sharpened blue pencil. Inside an SP you're fairly well unlimited in
what you can do...joins, orderings, groupings, unions, what have you, can
all be done inside the SP, and should be, to take advantage of the
optimizer and also to ensure a smooth output of the desired set,
ultimately. The key to effective dynamic selectable SPs is in well-planned
input args.

>Speaking of your book - is it available for purchase as a PDF or some
>other electronic form?