Re: user defined column functions?

From: Joe \ <joe_at_bftsi0.UUCP>
Date: Wed, 24 Apr 2002 12:12:18 -0700
Message-ID: <uce0tiqe398kdc_at_corp.supernews.com>


"--CELKO--" <71062.1056_at_compuserve.com> wrote in message <news:c0d87ec0.0204241009.6396150a_at_posting.google.com>...

> The idea is that there are three special cases - all positive numbers,
> one or more zeroes, and some negative numbers in the set.
> You can find out what your situation is with a quick test on the
> sign() of the minimum value in the set.
>
> Within the case where you have negative numbers, there are two
> sub-cases: (1) an even number of negatives or (2) an odd number of
> negatives. You then need to apply some High School algebra to
> determine the sign of the final result.
>
> SELECT CASE MIN (SIGN(nbr))
> WHEN 1 THEN EXP(SUM(LN(nbr))) -- all positive numbers
> WHEN 0 THEN 0.00 -- some zeroes
> WHEN -1 -- some negative numbers
> THEN (EXP(SUM(LN(ABS(nbr))))
> * (CASE WHEN
> MOD (SUM(ABS(SIGN(nbr)-1)/ 2)), 2) = 1
> THEN -1.00 ELSE 1.00 END)
> ELSE NULL END AS big_pi
> FROM NumberTable;

Couldn't MIN(SIGN(nbr)) be -1 even if one or more zeroes is present?

--
Joe Foster <mailto:jlfoster%40znet.com>     Got Thetans? <http://www.xenu.net/>
WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!
Received on Wed Apr 24 2002 - 21:12:18 CEST

Original text of this message