Subject | exists() in stored procedure with ordered |
---|---|
Author | Christian Waldmann |
Post date | 2009-10-21T16:01:23Z |
the following query works in ISQL with firebird 2.1.2:
select animalid
from PROCGETACTIVEANIMALS( :reportdate )
where not exists(
select tav.UIDANIMAL, tav.LOGTIMESTAMP
from TBLANIMALDAYREPORT tav
where (tav.UIDANIMAL = animalid ) and (tav.KIND = 'R')
order by tav.LOGTIMESTAMP
)
Now I try to do the same in a stored procedure, but when the order
clause is used, there is a compile error! Is there a limitation to
use ORDER BY in stored procedures or in EXISTS()?
begin
for select animalid
from PROCGETACTIVEANIMALS( :reportdate )
where not exists(
select tav.UIDANIMAL, tav.LOGTIMESTAMP
from TBLANIMALDAYREPORT tav
where (tav.UIDANIMAL = animalid ) and (tav.KIND = 'R')
/* order by tav.LOGTIMESTAMP */ )
into :ANIMALID
do suspend;
end
Christian Waldmann
select animalid
from PROCGETACTIVEANIMALS( :reportdate )
where not exists(
select tav.UIDANIMAL, tav.LOGTIMESTAMP
from TBLANIMALDAYREPORT tav
where (tav.UIDANIMAL = animalid ) and (tav.KIND = 'R')
order by tav.LOGTIMESTAMP
)
Now I try to do the same in a stored procedure, but when the order
clause is used, there is a compile error! Is there a limitation to
use ORDER BY in stored procedures or in EXISTS()?
begin
for select animalid
from PROCGETACTIVEANIMALS( :reportdate )
where not exists(
select tav.UIDANIMAL, tav.LOGTIMESTAMP
from TBLANIMALDAYREPORT tav
where (tav.UIDANIMAL = animalid ) and (tav.KIND = 'R')
/* order by tav.LOGTIMESTAMP */ )
into :ANIMALID
do suspend;
end
Christian Waldmann