Subject Re: [ib-support] Help with procedure
Author Helen Borrie
At 08:57 AM 24/04/2003 -0300, you wrote:
>Hi,
>
>At April 23, 2003, 22:48, Helen Borrie wrote:
>
> > The procedure itself looks OK except for two things (see notes 1) and 2)
> > below) but I think there is potential for the *detail data* which you are
> > using in the calculation to be not as you assume it is.
>
> > Notes about the stored procedure:
> > 1) Don't use SUSPEND in loops that don't return output to the client.
> > 2) You don't need to test NOT NULL return values for null, so these lines
> > will use processing cycles unnecessarily:
> > IF (TPRICE IS NULL) THEN TPRICE=0;
> > IF (TCOST IS NULL) THEN TCOST=0;
>
>Helen, both lines are needed, because the fields that they are applied
>to(in the UPDATE statement) have the constraint NOT NULL. And, that
>would generate an error.

Daniel, yes it would, if the columns being SUMmed were themselves
nullable. They are defined as
TOTAL_PRICE T_MONEY_TYPE not null,
TOTAL_COST T_MONEY_TYPE not null,

so, summing them can't return null.

h.