Subject | RE: [firebird-support] sql error |
---|---|
Author | Svein Erling Tysvær |
Post date | 2013-03-20T10:10:37Z |
>But now I get: Token unknown, column 1 line 24 (Without seeing at least 24 lines of code, it is hard to tell why it doesn't understand the parenthesis at the beginning of line 24 ;o)
>with this code I get an sql error, but it works until today perfect :o(What has changed? Have you upgraded anything?
From what you've shown so far, I'd change to:
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
order by 2 desc
rows 1)
select prio
from wgetnextprio
into :prio_to_find;
select fachnr
from tfachzuordnung
where le is null
and gesperrt = 0
and elementtyp = 1
and paltyp = :paltyp_Anfrage
and dispo = 0
and prio = :prio_to_find
order by fachnr
rows 1
into :ziel_einl;
(or possibly mix them together if you don't need prio_to_find later). I note that only the last select includes dispo, I assume you've checked that the content of ziel_einl is as desired if the record with the highest kount doesn't have any row with dispo = 0.
HTH,
Set