Re: user defined column functions?
From: Nis Jorgensen <nis_at_dkik.dk>
Date: Wed, 01 May 2002 11:36:44 +0200
Message-ID: <24dvcusbqrn9qmtefk3dh105c456en8b0g_at_4ax.com>
Date: Wed, 01 May 2002 11:36:44 +0200
Message-ID: <24dvcusbqrn9qmtefk3dh105c456en8b0g_at_4ax.com>
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) =
>1
> THEN -1.00
> ELSE 1.00 END) END)
> ELSE NULL END AS big_pi
>FROM NumberTable;
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