Hallo,
lade dir doch endlich mal IBExpert runter, Mensch !!!
SQL-Code:
set term #;
execute block
returns (ID INTEGER, MBID INTEGER)
as
declare variable ID1 INTEGER;
begin
for execute statement
'select ID FROM PERSONAL' into ID1
DO begin
ID = ID1;
MBID = null;
SELECT FIRST 1 TB.AUFTRAGID FROM TERMINAL_BUCHUNGEN TB WHERE TB.PERSONALID = :ID INTO MBID;
suspend;
end
end
#
set term ;#
execute block
was zum Teufel ist das denn ???
OK, ich weiss, was es ist
Aber das hat hier nichts zu suchen.
SELECT FIRST 1 TB.AUFTRAGID FROM TERMINAL_BUCHUNGEN TB WHERE TB.PERSONALID = :ID INTO MBID;
wo ist das
order by buchung desc ?
Vorschlag
SQL-Code:
CREATE PROCEDURE SP_Bla
RETURNS (
ID INTEGER,
MBID INTEGER)
AS
begin
for select ID FROM PERSONAL into :ID
DO begin
MBID = null;
SELECT FIRST 1 TB.AUFTRAGID
FROM TERMINAL_BUCHUNGEN TB WHERE TB.PERSONALID = ID
order by tb.buchung desc
INTO :MBID
suspend;
end
end
Heiko
[edit=mkinzler]SQL-Code in SQL-Tags gepackt Mfg, mkinzler[/edit]