Re: user defined column functions?
Date: Wed, 01 May 2002 11:36:44 +0200
On Sat, 27 Apr 2002 11:22:40 +0200, GoranG <icmc2MAKNUTIOVO_at_pop.tel.hr> wrote:
>Probably why domain errors occur.
>The logic is valid, however.
>Does this work?
>SELECT CASE MIN(ABS(SIGN(nbr)))
> WHEN 0 THEN 0.00
> WHEN 1 THEN
> (CASE MIN(SING(nbr))
> WHEN 1 THEN EXP(SUM(LN(nbr)))
> ELSE (EXP(SUM(LN(ABS(nbr)))) *
> (CASE WHEN MOD (SUM(ABS(SIGN(nbr)-1)/2)),2) =
> THEN -1.00
> ELSE 1.00 END) END)
> ELSE NULL END AS big_pi
The logic seems fine to me. However there seems to be a couple of unneeded CASE statements in there
SELECT CASE MIN(ABS(SIGN(nbr)))
WHEN 0 THEN 0.00 WHEN 1 THEN EXP(SUM(LN(ABS(nbr)))) * (1 - MOD (SUM(SIGN(nbr)-1),4)) ELSE 1.00 END AS big_pi -- the product of 0 numbers is 1!FROM NumberTable;
-- Nis Jorgensen Amsterdam Please include only relevant quotes, and reply below the quoted text. ThanksReceived on Wed May 01 2002 - 11:36:44 CEST