Subject | RE: [ib-support] error in stored procedure - token unkown |
---|---|
Author | Kevin Stanton |
Post date | 2003-04-08T20:01:56Z |
I believe you need an INTO clause:
FOR
select
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 :MYVARIABLE DO
SOMA = SOMA + POWER((NOTA_PROVA - MEDIA),2);
-----Original Message-----
From: ronaldorezende [mailto:ronaldinho79@...]
Sent: Tuesday, April 08, 2003 12:59 PM
To: ib-support@yahoogroups.com
Subject: [ib-support] error in stored procedure - token unkown
Whats wrong in this fragment of code? I'm receiving an error:
fmSQLScript.Script:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 47, char 3.
DO.
----------
FOR
select
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
DO
SOMA = SOMA + POWER((NOTA_PROVA - MEDIA),2);
-------------
POWER is a udf.
all code:
SET TERM ^;
CREATE PROCEDURE CLASSIFICACAO_GERAL
(CURSO INTEGER,
DISICIPLINA SMALLINT,
FASE SMALLINT,
TURMA VARCHAR(30),
NUMERO_PROVA SMALLINT,
PESO NUMERIC(18,2)
)
RETURNS
(CLASSIFICACAO INTEGER,
NOME_ALUNO VARCHAR(80),
ID_ALUNO INTEGER,
NOTA NUMERIC(5,2)
)
AS
DECLARE VARIABLE media NUMERIC(18,2); /* média de nota dos alunos
na prova */
DECLARE VARIABLE materia varchar(20); /* descrição da matéria */
DECLARE VARIABLE dpm NUMERIC(18,2) ; /* desvio padrão da matéria
*/
DECLARE VARIABLE dpa NUMERIC(18,2) ; /* desvio padrão do aluno */
DECLARE VARIABLE soma NUMERIC(18,2) ; /* soma = sum
((nota_prova_aluno - media)²) */
BEGIN
SOMA = 0.0;
SELECT AVG(NOTA_PROVA)
FROM DIARIO_PROVA_ALUNO
wHERE
NOTA_PROVA IS NOT NULL AND
ID_CURSO = :CURSO and
ID_DISCIPLINA = :DISCIPLINA and
ID_FASE = :FASE and
ID_TURMA = :TURMA and
NUMERO_PROVA = :NUMERO_PROVA
INTO :media;
FOR
select
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
DO
SOMA = SOMA + POWER((NOTA_PROVA - MEDIA),2);
DPM = SQRT( (SOMA / (SELECT COUNT(*) FROM DIARIO_PROVA_ALUNO wHERE
NOTA_PROVA IS NOT NULL)) );
FOR
SELECT
I.ID_PARCEIRO,
I.PRIMEIRO_NOME +' '+ || +I.SOBRENOME,
DPA.NOTA_PROVA
FROM INDIVIDUO I
INNER JOIN DIARIO_ALUNO DA
ON (I.ID_PARCEIRO = DA.ID_ALUNO)
INNER JOIN DIARIO_PROVA_ALUNO DPA
ON (DA.ID_CURSO = DPA.ID_CURSO) AND
(DA.ID_DISCIPLINA = DPA.ID_DISCIPLINA) AND
(DA.ID_FASE = DPA.ID_FASE) AND
(DA.ID_TURMA = DPA.ID_TURMA) AND
(DA.ID_ALUNO = DPA.ID_ALUNO)
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
:ID_ALUNO,
:NOME_ALUNO,
:NOTA
DO
BEGIN
CLASSSIFICACAO = CLASSIFICACAO + 1;
DPA = ( DPA.NOTA_PROVA / MEDIA) / (DMP * 100) + (500 * PESO);
SUSPEND;
END
END^
SET TERM ;^
Yahoo! Groups Sponsor
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
FOR
select
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 :MYVARIABLE DO
SOMA = SOMA + POWER((NOTA_PROVA - MEDIA),2);
-----Original Message-----
From: ronaldorezende [mailto:ronaldinho79@...]
Sent: Tuesday, April 08, 2003 12:59 PM
To: ib-support@yahoogroups.com
Subject: [ib-support] error in stored procedure - token unkown
Whats wrong in this fragment of code? I'm receiving an error:
fmSQLScript.Script:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 47, char 3.
DO.
----------
FOR
select
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
DO
SOMA = SOMA + POWER((NOTA_PROVA - MEDIA),2);
-------------
POWER is a udf.
all code:
SET TERM ^;
CREATE PROCEDURE CLASSIFICACAO_GERAL
(CURSO INTEGER,
DISICIPLINA SMALLINT,
FASE SMALLINT,
TURMA VARCHAR(30),
NUMERO_PROVA SMALLINT,
PESO NUMERIC(18,2)
)
RETURNS
(CLASSIFICACAO INTEGER,
NOME_ALUNO VARCHAR(80),
ID_ALUNO INTEGER,
NOTA NUMERIC(5,2)
)
AS
DECLARE VARIABLE media NUMERIC(18,2); /* média de nota dos alunos
na prova */
DECLARE VARIABLE materia varchar(20); /* descrição da matéria */
DECLARE VARIABLE dpm NUMERIC(18,2) ; /* desvio padrão da matéria
*/
DECLARE VARIABLE dpa NUMERIC(18,2) ; /* desvio padrão do aluno */
DECLARE VARIABLE soma NUMERIC(18,2) ; /* soma = sum
((nota_prova_aluno - media)²) */
BEGIN
SOMA = 0.0;
SELECT AVG(NOTA_PROVA)
FROM DIARIO_PROVA_ALUNO
wHERE
NOTA_PROVA IS NOT NULL AND
ID_CURSO = :CURSO and
ID_DISCIPLINA = :DISCIPLINA and
ID_FASE = :FASE and
ID_TURMA = :TURMA and
NUMERO_PROVA = :NUMERO_PROVA
INTO :media;
FOR
select
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
DO
SOMA = SOMA + POWER((NOTA_PROVA - MEDIA),2);
DPM = SQRT( (SOMA / (SELECT COUNT(*) FROM DIARIO_PROVA_ALUNO wHERE
NOTA_PROVA IS NOT NULL)) );
FOR
SELECT
I.ID_PARCEIRO,
I.PRIMEIRO_NOME +' '+ || +I.SOBRENOME,
DPA.NOTA_PROVA
FROM INDIVIDUO I
INNER JOIN DIARIO_ALUNO DA
ON (I.ID_PARCEIRO = DA.ID_ALUNO)
INNER JOIN DIARIO_PROVA_ALUNO DPA
ON (DA.ID_CURSO = DPA.ID_CURSO) AND
(DA.ID_DISCIPLINA = DPA.ID_DISCIPLINA) AND
(DA.ID_FASE = DPA.ID_FASE) AND
(DA.ID_TURMA = DPA.ID_TURMA) AND
(DA.ID_ALUNO = DPA.ID_ALUNO)
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
:ID_ALUNO,
:NOME_ALUNO,
:NOTA
DO
BEGIN
CLASSSIFICACAO = CLASSIFICACAO + 1;
DPA = ( DPA.NOTA_PROVA / MEDIA) / (DMP * 100) + (500 * PESO);
SUSPEND;
END
END^
SET TERM ;^
Yahoo! Groups Sponsor
To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]