Einzelnen Beitrag anzeigen

Nightfly

Registriert seit: 25. Mär 2004
Ort: Dresden
118 Beiträge
 
#1

unklares verhalten einer stored proc in Firebird

  Alt 2. Apr 2004, 09:57
Hi

also, folgender ausdruck liefert bei einer konkreten variablenbelegung ein ergebniss:
SQL-Code:
select sum(R_ANZ * R_EPREIS) from RECHNUNG R, MAIN M /*die negativen*/
where (M.stelle = R.Stelle) and (M.id = R.bereich) and (M.calc = 0) and (R.stelle like '%'||:stelle||'%') and (r.bereich < :zeile) and (EXTRACT(YEAR from R.R_Datum) = :Jahr) and (EXTRACT(MONTH from R.R_Datum)= :Monat)
Die folgende StoredProc gibt aber <null> zurück,obwohl sie doch zu dem obigen ausdruck identisch ist. Hilfe,ich versteh das nich!!


SQL-Code:
CREATE PROCEDURE SUM_ZEILE_BER (
    STELLE CHAR(9),
    JAHR INTEGER,
    ZEILE INTEGER,
    MONAT INTEGER)
RETURNS (
    ERGEBNIS NUMERIC(9,2))
AS
DECLARE VARIABLE DIF1 NUMERIC(9,2) = 1;
begin
  select sum(R_ANZ * R_EPREIS) from RECHNUNG R, MAIN M /*die negativen*/
  where (M.stelle = R.Stelle) and (M.id = R.bereich) and (M.calc = 0) and (R.stelle like '%'||:stelle||'%') and (r.bereich < :zeile) and (EXTRACT(YEAR from R.R_Datum) = :Jahr) and (EXTRACT(MONTH from R.R_Datum)= :Monat)
  into :dif1;
  ergebnis = :dif1;
  suspend;
end
  Mit Zitat antworten Zitat