Subject | strange problem with stored procedure |
---|---|
Author | Bert Neef |
Post date | 2002-02-22T09:55:27Z |
Hi all,
I run into a problem when trying to use the following stored procedure from
a TIB_cursor:
SET TERM !! ;
CREATE PROCEDURE GetEditKeuzeMogelijkheden(Klas varchar(50), Periode
varchar(100), Soort varchar(3), Dag varchar(9), Uur varchar(50))
RETURNS (KeuzeNr Integer, Lokaal varchar(50), Vak varchar(150), Activiteit
Blob sub_type 1,Docent varchar(50), MaxAantal Integer, ShareState Integer) AS
BEGIN
FOR Select K.KeuzeNr,K.Lokaal,K.Vak,K.Activiteit,K.Docent,K.MaxAantal,
B.ShareState
From KeuzeInformatie K INNER JOIN BeschikBareKeuzes B ON
K.KeuzeNr=B.KeuzeNr
Where K.Dag=:dag AND K.Uur=:uur AND K.Klas=:Klas AND K.Soort=:Soort AND
K.Periode=:Periode
UNION
Select K.KeuzeNr,K.Lokaal,K.Vak,K.Activiteit,K.Docent,K.MaxAantal,
B.ShareState
From KeuzeInformatie K INNER JOIN BeschikBareKeuzes B ON
K.KeuzeNr=B.KeuzeNr
Where K.Dag=:dag AND K.Uur=:uur AND K.Klas='Gedeeld' AND B.Klas=:Klas
AND K.Soort=:Soort AND K.periode=:Periode
INTO :KeuzeNr, :Lokaal, :Vak, :Activiteit, :Docent, :MaxAantal,
:ShareState
DO SUSPEND;
END !!
SET TERM ;!!
with the tib_cursor containg the following sql :
SELECT keuzenr,lokaal,vak,activiteit,docent,maxaantal,sharestate FROM
getEditKeuzeMogelijkheden(:Klas,:Periode,:Soort, :Dag, :Uur);
it returns the following error message :
ISC ERROR CODE:335544384
ISC ERROR MESSAGE:
internal error
STATEMENT:
TIB_Cursor: "<TApplication>.frmSQL.crEdit."
SQL ERROR CODE:-902
When I ran the code outside of a stored procedure (Select ...... Into.....)
everything goes allright and I get the results I expected. so what I am a
doing wrong? How can I make this work in a stored procedure?
Thanks in advance,
Bert Neef
I run into a problem when trying to use the following stored procedure from
a TIB_cursor:
SET TERM !! ;
CREATE PROCEDURE GetEditKeuzeMogelijkheden(Klas varchar(50), Periode
varchar(100), Soort varchar(3), Dag varchar(9), Uur varchar(50))
RETURNS (KeuzeNr Integer, Lokaal varchar(50), Vak varchar(150), Activiteit
Blob sub_type 1,Docent varchar(50), MaxAantal Integer, ShareState Integer) AS
BEGIN
FOR Select K.KeuzeNr,K.Lokaal,K.Vak,K.Activiteit,K.Docent,K.MaxAantal,
B.ShareState
From KeuzeInformatie K INNER JOIN BeschikBareKeuzes B ON
K.KeuzeNr=B.KeuzeNr
Where K.Dag=:dag AND K.Uur=:uur AND K.Klas=:Klas AND K.Soort=:Soort AND
K.Periode=:Periode
UNION
Select K.KeuzeNr,K.Lokaal,K.Vak,K.Activiteit,K.Docent,K.MaxAantal,
B.ShareState
From KeuzeInformatie K INNER JOIN BeschikBareKeuzes B ON
K.KeuzeNr=B.KeuzeNr
Where K.Dag=:dag AND K.Uur=:uur AND K.Klas='Gedeeld' AND B.Klas=:Klas
AND K.Soort=:Soort AND K.periode=:Periode
INTO :KeuzeNr, :Lokaal, :Vak, :Activiteit, :Docent, :MaxAantal,
:ShareState
DO SUSPEND;
END !!
SET TERM ;!!
with the tib_cursor containg the following sql :
SELECT keuzenr,lokaal,vak,activiteit,docent,maxaantal,sharestate FROM
getEditKeuzeMogelijkheden(:Klas,:Periode,:Soort, :Dag, :Uur);
it returns the following error message :
ISC ERROR CODE:335544384
ISC ERROR MESSAGE:
internal error
STATEMENT:
TIB_Cursor: "<TApplication>.frmSQL.crEdit."
SQL ERROR CODE:-902
When I ran the code outside of a stored procedure (Select ...... Into.....)
everything goes allright and I get the results I expected. so what I am a
doing wrong? How can I make this work in a stored procedure?
Thanks in advance,
Bert Neef