RE: Re[2]: Instead of SUM() I require MULTIPLY

  • From: "Lex de Haan" <lex.de.haan@xxxxxxxxxxxxxx>
  • To: <yaoyongping@xxxxxxxxx>, "'Oracle-L Freelists'" <Oracle-L@xxxxxxxxxxxxx>
  • Date: Sun, 11 Dec 2005 13:11:45 +0100

yes, you can -- it just needs some coding efforts.
 
you can return the product (result of multiplication) of a set of numbers,
you can return the concatenation of a set of strings,
you can return *anything* that makes sense, based on the following assumptions:
 
- the input is a set of values (of a certain data type)
- your code does *something* with those values
- the output is a single value; your code determines *which* value
 
so just use your fantasy, and then your coding skills :-)
see the documentation I mentioned earlier.
 
note that it is sometimes non-trivial to handle all the borderline cases 
(like NULLs and empty sets) and to handle all exceptions/error situations 
properly -- but it can be done.
 
As you can see, Oracle SQL is very extensible!


kind regards,

Lex.

---------------------------------------------------------------------
Jonathan Lewis Seminar  <http://www.naturaljoin.nl/events/seminars.html>
http://www.naturaljoin.nl/events/seminars.html
---------------------------------------------------------------------


  _____  

From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On
Behalf Of Yongping Yao
Sent: Sunday, December 11, 2005 12:17
To: Oracle-L Freelists
Subject: Re: Re[2]: Instead of SUM() I require MULTIPLY


Thanks all,
It's a very helpful solution. Have someone considered some similar occassion
when we have to concat values?
For example, 
1  a
1  b
3  c
4  a
1  e
then we want the resultset as
1 a,b,e 
3 c
4 a

I have a solution in PL/SQL. Can a simple SQL solve it? Just curious :)


On 12/11/05, Ethan Post < post.ethan@xxxxxxxxx <mailto:post.ethan@xxxxxxxxx> >
wrote: 

Wow, great information everyone! Thanks for the more than helpful responses. 

BEGIN:VCARD
VERSION:2.1
N:de Haan;Lex
FN:Lex de Haan
ORG:Natural Join B.V.
TEL;WORK;VOICE:+31.30.2515022
TEL;HOME;VOICE:+31.30.2518795
TEL;CELL;VOICE:+31.62.2955714
TEL;WORK;FAX:+31.30.2523366
ADR;WORK:;;Pieter Breughelstraat 10;Utrecht;;3583 SK;Netherlands
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:Pieter Breughelstraat 10=0D=0AUtrecht 3583 
SK=0D=0ANetherlands
URL;WORK:http://www.naturaljoin.nl
EMAIL;PREF;INTERNET:lex.de.haan@xxxxxxxxxxxxxx
REV:20040224T160439Z
END:VCARD

Other related posts: