Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: aggregate function
It is generally possible - but there is a limitation that makes the specific example fail.
You can write a function to do:
select f(col1, col2, col3), col1, col2,col3
from table
group by col1, col2, col3;
The function simply has to embed a
select {requirements} from table
where col1 = parm1
and col2 = parm2
and col3 = parm3
It seems to work quite efficiently as the
function is called AFTER the group by,
i.e. just once for each combination of
col1, col2, col3.
-- Jonathan Lewis Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk Practical Oracle 8i: Building Efficient Databases Publishers: Addison-Wesley See a first review at: http://www.ixora.com.au/resources/index.htm#practical_8i More reviews at: http://www.jlcomp.demon.co.uk/book_rev.html Alex Filonov wrote in message <91r5up$ldk$1_at_nnrp1.deja.com>...Received on Wed Dec 20 2000 - 16:11:59 CST
>As far as I know, you can't.
>
>In article <91qgc1$16n$1_at_nnrp1.deja.com>,
> slezakp_at_my-deja.com wrote:
>> Can one write an aggregate function in Oracle 8.1.6?
>>
>> Example: normal sum
>>
>> select sum(tools) from powertools;
>>
>> I want to be able to do:
>>
>> select mysum(tools) from powertools.
>>
>> Note that mysum will not know what table or column ahead of time.
>>
>> Thanks,
>> Paul
>>
>> Sent via Deja.com
>> http://www.deja.com/
>>
>
>
>Sent via Deja.com
>http://www.deja.com/