Subject | Re: [firebird-support] Re: Register standard deviation as a stored procedure. |
---|---|
Author | Aage Johansen |
Post date | 2009-07-30T21:30:31Z |
tankinguard wrote:
a) include a SUSPEND, and b) call it with something like
select NRESULT
from STDEV
where STABLE = 'table'
and SFIELD = 'score'
I haven't read your code carefully, so ...
--
Aage J.
> When remaking by the method which you taught, I have got the result.' || sTable
> But it does not become still like MySQL. mmm...
>
> -----------------------------------------
> SET TERM !!;
> CREATE OR ALTER PROCEDURE STDEV(sTable CHAR(31), sField CHAR(31))
> RETURNS (nResult DOUBLE PRECISION) AS
> BEGIN
> EXECUTE STATEMENT 'SELECT SQRT((COUNT(' || sField || ') *
> SUM(POWER(' || sField || ', 2)) - POWER(SUM(' || sField || '), 2))
> / (COUNT(' || sField || ') * (COUNT(' || sField || ') - 1))) FROM
> INTO :nResult;Does it help if you
> END !!
> SET TERM;!!
> -----------------------------------------
> EXECUTE PROCEDURE STDEV('table', 'score');
> -----------------------------------------
>
a) include a SUSPEND, and b) call it with something like
select NRESULT
from STDEV
where STABLE = 'table'
and SFIELD = 'score'
I haven't read your code carefully, so ...
--
Aage J.