Hello,
with this code I get an sql error, but it works until today perfect :o( with wgetnextprio as (select prio, count(*) as kount from tfachzuordnung where le is null and gesperrt = 0 and elementtyp = 1 and paltyp = :paltyp_anfrage group by prio) select first 1 prio from wgetnextprio where kount = (select max(kount) from wgetnextprio)into :prio_to_find; select first 1 fachnr from tfachzuordnung a where a.elementtyp = 1 and a.paltyp = :paltyp_Anfrage and a.dispo = 0 and prio = :prio_to_find and a.le is null and a.gesperrt = 0 order by fachnr into :ziel_einl; paltyp_anfrage = 2. If I execute the first part, I get: Prio A 1 piece available, Prio B 1 piece available, Prio C 1 piece available. But now I get: Token unknown, column 1 line 24 ( What can be wrong? Thanks. BR Olaf [Non-text portions of this message have been removed]