Subject Re: Register standard deviation as a stored procedure.
Author Jeroen Wenting
Arrays are not allowed as input to stored procedures (interbase language reference page 172).
Besides which, you're trying to apply mathematical operations on character datatypes, which is not allowed in SQL AFAIK.

You'd have to convert the string into an array of integers internally and use that for your calculation.

--- In firebird-support@yahoogroups.com, "tankinguard" <tankinguard@...> wrote:
>
> 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?
>