Art Majtenyi wrote:
Reference manual says, "You can also create your own aggregates to
perform other set functions such as calculating the standard deviation."
Has anyone done this?...Is there any docs to help with this?...It's
not as easy as a scalar function.
Art Majtenyi, [EMAIL PROTECTED]
WebSphere Business Monitor Development
IBM Corporation, RTP, NC
O: 919/254-4443, M: 919/302-8827
Hi,
My apologies if my reply was a click too quick.
Would it be please possible to give more details on the specific nature
of the problem you are facing
while implementing the stored function to calculate the Standard deviation?
Here are my guesses from what I think is the problem you could be facing,
The algorithm for implementing the stored function should not be a
problem because once
you have the data values you just have to write the computational
algorithm for calculating the SD
from the set of values (The ability to write functions and procedures
in Java brings the complete
set of Java apis into your SQL environment as server side logic. A
function or procedure may call
any of the standard Java libraries, any of the standard Java
extensions, or other third party libraries).
The return type from the function should not be a problem because I
believe the return type would
be a floating point datatype.
I guess you are worried about the input data that you need to give to
the function and how
to pass such a large number of input values.
A simple solution I can think of if the input values is very large and
is very dynamic is to store
the values in a database table. Query this table from the Java program
associated with this
java stored function and pass this set of values to the SD calculating
logic.
This way each time you want to modify any data on the input data set you
would perform the
modifications in the database table and call this function again. This
would help you modify
the large volume of data, modify it as many times as you want easily
using simple SQL queries
and just call the function everytime you want to calculate the SD for
this large dataset.
If you think a table is not required (your dataset is small) you could
just pass the parameters while
calling the function each time.
Hope the above helps in your application. If you need more
clarifications pls feel free to ask more
questions. It would be a pleasure to answer.
cheers,
Narayanan