Subject Order of arguments significant in SP body?
Author davidlhoffman66
Hi, is it possible that the order in which input arguments are used in
the body of a stored procedure is significant? (FB 2.01)

The 2 SP's below are identical except for the order in which the
:startDate and :endDate replaceable parameters are used in the select
query. I am seeing completely different results for the two versions.
If I swap the 2 input arguments during the call, they match.


VERSION 1:

create OR ALTER procedure aba$_sqlShoCas_Pre_1_DLH(
startDate TIMESTAMP,
endDate TIMESTAMP
)
as
begin
delete from aba$tempTC_DLH;
insert into aba$tempTC_DLH
select distinct
sc.Show_IID,
sc.Case_IID,
sc.Ctain_IID,
s.ShipOutDate,
s.ShipRetDate,
s.Lock_Date
from ShoCas sc
join Shows s on ( s.Show_IID = sc.Show_IID )
where (s.ShipRetDate >= :startDate)
and (s.ShipOutDate < :endDate)
and (s.Killed = 'N')

and ((sc.Killed = 'N') or ((sc.Killed = 'Y') and (sc.ModDate >=
s.Lock_Date)))
and (sc.Ctain_IID = '0')
;
end;



VERSION 2:

create OR ALTER procedure aba$_sqlShoCas_Pre_1_DLH(
startDate TIMESTAMP,
endDate TIMESTAMP
)
as
begin
delete from aba$tempTC_DLH;
insert into aba$tempTC_DLH
select distinct
sc.Show_IID,
sc.Case_IID,
sc.Ctain_IID,
s.ShipOutDate,
s.ShipRetDate,
s.Lock_Date
from ShoCas sc
join Shows s on ( s.Show_IID = sc.Show_IID )
where (s.ShipOutDate < :endDate)
and (s.ShipRetDate >= :startDate)
and (s.Killed = 'N')

and ((sc.Killed = 'N') or ((sc.Killed = 'Y') and (sc.ModDate >=
s.Lock_Date)))
and (sc.Ctain_IID = '0')
;
end;




Can this be? Am I crazy?

Many thanks for any insights-
-David