Subject | column as parameter to udf |
---|---|
Author | ronaldorezende |
Post date | 2003-05-13T12:52:12Z |
This line is returnig 0.00. What's the problem? NOTA_PROVA is a
variable and MEDIA is a input parameter.
I alredy try in this two forms:
POWER((:NOTA_PROVA - :MEDIA),2);
POWER((:NOTA_PROVA - :MEDIA),2);
If I make POWER(8.0,2) the result is ok.
the code:
---------------
CREATE PROCEDURE DESVIO_PADRAO_MATERIA (
CURSO INTEGER,
DISCIPLINA SMALLINT,
FASE SMALLINT,
TURMA VARCHAR(10) CHARACTER SET WIN1252,
NUMERO_PROVA SMALLINT,
MEDIA NUMERIC(18,2),
QTD_ALUNO SMALLINT)
RETURNS (
DPM NUMERIC(18,2))
AS
DECLARE VARIABLE SOMA NUMERIC(18,2);
DECLARE VARIABLE NOTA_PROVA NUMERIC(5,2);
begin
SOMA = 0.0;
FOR
select
DPA.NOTA_PROVA
from DIARIO_PROVA_ALUNO DPA
where
DPA.NOTA_PROVA is not null and
DPA.ID_CURSO = :CURSO and
DPA.ID_DISCIPLINA = :DISCIPLINA and
DPA.ID_FASE = :FASE and
DPA.ID_TURMA = :TURMA and
DPA.NUMERO_PROVA = :NUMERO_PROVA
into :NOTA_PROVA
DO
SOMA = SOMA + POWER((:NOTA_PROVA - :MEDIA),2);
DPM = SQRT( (SOMA / qtd_aluno) );
suspend;
end
^
variable and MEDIA is a input parameter.
I alredy try in this two forms:
POWER((:NOTA_PROVA - :MEDIA),2);
POWER((:NOTA_PROVA - :MEDIA),2);
If I make POWER(8.0,2) the result is ok.
the code:
---------------
CREATE PROCEDURE DESVIO_PADRAO_MATERIA (
CURSO INTEGER,
DISCIPLINA SMALLINT,
FASE SMALLINT,
TURMA VARCHAR(10) CHARACTER SET WIN1252,
NUMERO_PROVA SMALLINT,
MEDIA NUMERIC(18,2),
QTD_ALUNO SMALLINT)
RETURNS (
DPM NUMERIC(18,2))
AS
DECLARE VARIABLE SOMA NUMERIC(18,2);
DECLARE VARIABLE NOTA_PROVA NUMERIC(5,2);
begin
SOMA = 0.0;
FOR
select
DPA.NOTA_PROVA
from DIARIO_PROVA_ALUNO DPA
where
DPA.NOTA_PROVA is not null and
DPA.ID_CURSO = :CURSO and
DPA.ID_DISCIPLINA = :DISCIPLINA and
DPA.ID_FASE = :FASE and
DPA.ID_TURMA = :TURMA and
DPA.NUMERO_PROVA = :NUMERO_PROVA
into :NOTA_PROVA
DO
SOMA = SOMA + POWER((:NOTA_PROVA - :MEDIA),2);
DPM = SQRT( (SOMA / qtd_aluno) );
suspend;
end
^