Subject | Register standard deviation as a stored procedure. |
---|---|
Author | tankinguard |
Post date | 2009-07-30T03:33:32Z |
Since there is nothing corresponding to the STDEV function which calculates standard deviation in Firebird, I'm examining implementing as a stored procedure. Although I wrote the following SQL sentences, the error message "SQL error code =-104 Invalid command" returns from Firebird.
------------------------------------------------
SET TERM !!;
CREATE OR ALTER PROCEDURE STDEV(AParam CHAR(1024))
RETURNS (AResult DOUBLE PRECISION)
AS
BEGIN
AResult = SQRT((COUNT(AParam) * SUM(POWER(AParam, 2)) - POWER(SUM(AParam), 2)) / (COUNT(AParam) * (COUNT(AParam) - 1)));
END !!
SET TERM;!!
------------------------------------------------
Probably I think it's a problem of syntax simply. Is there any solution?
------------------------------------------------
SET TERM !!;
CREATE OR ALTER PROCEDURE STDEV(AParam CHAR(1024))
RETURNS (AResult DOUBLE PRECISION)
AS
BEGIN
AResult = SQRT((COUNT(AParam) * SUM(POWER(AParam, 2)) - POWER(SUM(AParam), 2)) / (COUNT(AParam) * (COUNT(AParam) - 1)));
END !!
SET TERM;!!
------------------------------------------------
Probably I think it's a problem of syntax simply. Is there any solution?