Subject | Repost: No current record for fetch operation with join upon SP |
---|---|
Author | mmenaz |
Post date | 2002-02-21T13:32:46Z |
Sorry for the repost, but I do really need a solution/address for this problem...
FB RC2, IBO Fr, Win2000sp1
I've a query with a join upon a stored procedure. Everything is ok since the result set is not empty. If the condition of the where clause is so that an empty result set would be returned, the following error appears:
ISC ERROR CODE:335544348
no current record for fetch operation
the problem is related to the stored procedure SEL_CODICI_CONTABILI join, that is a simple for select ... union ... into .. suspend. Is something wrong with the query or with the stored procedure?
How can I avoid the error in such a situation?
Tanks
Marco Menardi
----------- QUERY ------- (simplified version)
WHERE MOVCON_TESTA.MOVCON_ID > 0 --- OK (10 rows returned)
WHERE MOVCON_TESTA.MOVCON_ID < 0 --- ERROR (should be empty)
SELECT MOVCON_TESTA.MOVCON_ID,
MOVCON_TESTA.ESERCIZIO_ID,
MOVCON_TESTA.CONDOMINIO_ID,
MOVCON_TESTA.ESERCIZIO_ID,
SEL_CODICI_CONTABILI.OUT_DESCRIZIONEDISP AS COD_CONT_DESCRIZIONE,
MOVCON_RIGHE.CONTO_ID
FROM MOVCON_TESTA
INNER JOIN MOVCON_RIGHE ON (MOVCON_TESTA.MOVCON_ID = MOVCON_RIGHE.MOVCON_ID)
INNER JOIN SEL_CODICI_CONTABILI(MOVCON_TESTA.CONDOMINIO_ID, MOVCON_TESTA.ESERCIZIO_ID) ON (MOVCON_RIGHE.CONTO_ID = SEL_CODICI_CONTABILI.OUT_CODICE_ID)
/* one of the following
WHERE MOVCON_TESTA.MOVCON_ID > 0
WHERE MOVCON_TESTA.MOVCON_ID > 0
*/
----------- STORED PROCEDURE -------
CREATE PROCEDURE SEL_CODICI_CONTABILI (
IN_CONDOMINIO_ID VARCHAR (6),
IN_ESERCIZIO_ID VARCHAR (6))
RETURNS (
OUT_CODICE_ID VARCHAR (6),
OUT_DESCRIZIONEDISP VARCHAR (30),
OUT_TIPOCONTO CHAR (1),
OUT_AUTOM_CONTABILE CHAR (1),
OUT_AUTOM_SCADENZIARIO CHAR (1),
OUT_DIFFERENZIA_EDIFICIO CHAR (1),
OUT_DIFFERENZIA_SCALA CHAR (1),
OUT_TITOLO_RELAZIONE CHAR (1),
OUT_ORIGINE CHAR (2))
AS
BEGIN
FOR
SELECT FORNITORI.FORNITORE_ID,
FORNITORI.DESCRIZIONEDISP,
'-' AS TIPOCONTO,
'-' AS AUTOM_CONTABILE,
'-' AS AUTOM_SCADENZIARIO,
'-' AS DIFFERENZIA_EDIFICIO,
'-' AS DIFFERENZIA_SCALA,
'-' AS TITOLO_RELAZIONE,
'FF' AS ORIGINE
FROM FORNITORI
WHERE NOT ( (FORNITORI.ELIMINATO='S') AND (:IN_ESERCIZIO_ID='000000') )
UNION
SELECT PIANO_CONTI.CONTO_ID,
PIANO_CONTI.DESCRIZIONEDISP,
PIANO_CONTI.TIPO_CONTO,
PIANO_CONTI.AUTOM_CONTABILE,
PIANO_CONTI.AUTOM_SCADENZIARIO,
PIANO_CONTI.DIFFERENZIA_EDIFICIO,
PIANO_CONTI.DIFFERENZIA_SCALA,
'-',
'00'
FROM PIANO_CONTI
WHERE (CONDOMINIO_ID = :IN_CONDOMINIO_ID) AND (ESERCIZIO_ID = :IN_ESERCIZIO_ID)
AND (strlen(CONTO_ID)>2)
UNION
SELECT UNITA_U_CLIENTI.UICC_ID,
UNITA_U_CLIENTI.DESCRIZIONEDISP,
'-',
'-',
'-',
'-',
'-',
UNITA_U_CLIENTI.TITOLO_RELAZIONE,
'CC'
FROM UNITA_U_CLIENTI
INNER JOIN UNITA_IMMOBILIARI ON (UNITA_U_CLIENTI.UNITAIMM_ID = UNITA_IMMOBILIARI.UNITAIMM_ID)
WHERE (CONDOMINIO_ID = :IN_CONDOMINIO_ID) AND (ESERCIZIO_ID = :IN_ESERCIZIO_ID)
AND (UNITA_U_CLIENTI.LEGAME_PRINCIPALE_ID IS NULL)
INTO
:OUT_CODICE_ID,
:OUT_DESCRIZIONEDISP,
:OUT_TIPOCONTO,
:OUT_AUTOM_CONTABILE,
:OUT_AUTOM_SCADENZIARIO,
:OUT_DIFFERENZIA_EDIFICIO,
:OUT_DIFFERENZIA_SCALA,
:OUT_TITOLO_RELAZIONE,
:OUT_ORIGINE
DO BEGIN
SUSPEND;
END
END
--- End forwarded message ---
FB RC2, IBO Fr, Win2000sp1
I've a query with a join upon a stored procedure. Everything is ok since the result set is not empty. If the condition of the where clause is so that an empty result set would be returned, the following error appears:
ISC ERROR CODE:335544348
no current record for fetch operation
the problem is related to the stored procedure SEL_CODICI_CONTABILI join, that is a simple for select ... union ... into .. suspend. Is something wrong with the query or with the stored procedure?
How can I avoid the error in such a situation?
Tanks
Marco Menardi
----------- QUERY ------- (simplified version)
WHERE MOVCON_TESTA.MOVCON_ID > 0 --- OK (10 rows returned)
WHERE MOVCON_TESTA.MOVCON_ID < 0 --- ERROR (should be empty)
SELECT MOVCON_TESTA.MOVCON_ID,
MOVCON_TESTA.ESERCIZIO_ID,
MOVCON_TESTA.CONDOMINIO_ID,
MOVCON_TESTA.ESERCIZIO_ID,
SEL_CODICI_CONTABILI.OUT_DESCRIZIONEDISP AS COD_CONT_DESCRIZIONE,
MOVCON_RIGHE.CONTO_ID
FROM MOVCON_TESTA
INNER JOIN MOVCON_RIGHE ON (MOVCON_TESTA.MOVCON_ID = MOVCON_RIGHE.MOVCON_ID)
INNER JOIN SEL_CODICI_CONTABILI(MOVCON_TESTA.CONDOMINIO_ID, MOVCON_TESTA.ESERCIZIO_ID) ON (MOVCON_RIGHE.CONTO_ID = SEL_CODICI_CONTABILI.OUT_CODICE_ID)
/* one of the following
WHERE MOVCON_TESTA.MOVCON_ID > 0
WHERE MOVCON_TESTA.MOVCON_ID > 0
*/
----------- STORED PROCEDURE -------
CREATE PROCEDURE SEL_CODICI_CONTABILI (
IN_CONDOMINIO_ID VARCHAR (6),
IN_ESERCIZIO_ID VARCHAR (6))
RETURNS (
OUT_CODICE_ID VARCHAR (6),
OUT_DESCRIZIONEDISP VARCHAR (30),
OUT_TIPOCONTO CHAR (1),
OUT_AUTOM_CONTABILE CHAR (1),
OUT_AUTOM_SCADENZIARIO CHAR (1),
OUT_DIFFERENZIA_EDIFICIO CHAR (1),
OUT_DIFFERENZIA_SCALA CHAR (1),
OUT_TITOLO_RELAZIONE CHAR (1),
OUT_ORIGINE CHAR (2))
AS
BEGIN
FOR
SELECT FORNITORI.FORNITORE_ID,
FORNITORI.DESCRIZIONEDISP,
'-' AS TIPOCONTO,
'-' AS AUTOM_CONTABILE,
'-' AS AUTOM_SCADENZIARIO,
'-' AS DIFFERENZIA_EDIFICIO,
'-' AS DIFFERENZIA_SCALA,
'-' AS TITOLO_RELAZIONE,
'FF' AS ORIGINE
FROM FORNITORI
WHERE NOT ( (FORNITORI.ELIMINATO='S') AND (:IN_ESERCIZIO_ID='000000') )
UNION
SELECT PIANO_CONTI.CONTO_ID,
PIANO_CONTI.DESCRIZIONEDISP,
PIANO_CONTI.TIPO_CONTO,
PIANO_CONTI.AUTOM_CONTABILE,
PIANO_CONTI.AUTOM_SCADENZIARIO,
PIANO_CONTI.DIFFERENZIA_EDIFICIO,
PIANO_CONTI.DIFFERENZIA_SCALA,
'-',
'00'
FROM PIANO_CONTI
WHERE (CONDOMINIO_ID = :IN_CONDOMINIO_ID) AND (ESERCIZIO_ID = :IN_ESERCIZIO_ID)
AND (strlen(CONTO_ID)>2)
UNION
SELECT UNITA_U_CLIENTI.UICC_ID,
UNITA_U_CLIENTI.DESCRIZIONEDISP,
'-',
'-',
'-',
'-',
'-',
UNITA_U_CLIENTI.TITOLO_RELAZIONE,
'CC'
FROM UNITA_U_CLIENTI
INNER JOIN UNITA_IMMOBILIARI ON (UNITA_U_CLIENTI.UNITAIMM_ID = UNITA_IMMOBILIARI.UNITAIMM_ID)
WHERE (CONDOMINIO_ID = :IN_CONDOMINIO_ID) AND (ESERCIZIO_ID = :IN_ESERCIZIO_ID)
AND (UNITA_U_CLIENTI.LEGAME_PRINCIPALE_ID IS NULL)
INTO
:OUT_CODICE_ID,
:OUT_DESCRIZIONEDISP,
:OUT_TIPOCONTO,
:OUT_AUTOM_CONTABILE,
:OUT_AUTOM_SCADENZIARIO,
:OUT_DIFFERENZIA_EDIFICIO,
:OUT_DIFFERENZIA_SCALA,
:OUT_TITOLO_RELAZIONE,
:OUT_ORIGINE
DO BEGIN
SUSPEND;
END
END
--- End forwarded message ---