Subject Re: [ib-support] Computed fields and nulls
Author Marcus Monaghan
> >I then tested this by doing:
> >"SELECT MNTH_OPEN_SCORE FROM
> >CALC_START_MNTH_SCORE(PLAYER_MONTHS.PLAYER_CODE,
PLAYER_MONTHS.PLAYER_YEAR,
> >PLAYER_MONTHS.PLAYER_MONTH);"
> >within isql, but it still returned Null. I then changed the procedure so
> >"MNTH_OPEN_SCORE = 0" and it STILL returned null.
>
> Where are you getting those input values from? My guess is that they are
> null. Inputs to stored procedures have to be constants.

The values are coming from the fields within the record the computed field
belongs to. If you have a look at CALC_START_MNTH_SCORE I'm passing in the
values stored in PLAYER_MONTHS.PLAYER_CODE, PLAYER_MONTHS.PLAYER_YEAR and
PLAYER_MONTHS.PLAYER_MONTH from the record the calculated field is
calculating.

> By the way, contrary to other other advice, you don't use SUSPEND in a
> procedure that returns only a one-row set. SUSPEND doesn't do anything,
> other than perform an EXIT, under any conditions except when you are
> processing a cursor (i.e. operating a FOR SELECT loop). You can (and
> probably should) invoke it with EXECUTE and read the output parameters.
>

I have just added SUSPEND to the end of the procedure and it now works. This
means that the inputs to the stored proecdure doesn't have to be a constant,
the values are taken from the other fields locates on the record. Is this
correct or have I found a bug that is a feature? If so can we NOT fix this
feature :0)

Regards,
Marcus.