Subject | SP questions |
---|---|
Author | martinthrelly |
Post date | 2007-01-03T22:40:01Z |
hi there
i am writing a reporting application and am considering how best to
get the data from the firebird 1.5 database. my reports all contain
user selectable filters. as far as i can see my 2 options are SPs or
to construct dynamic SQLs. my preferred route is definetely SPs,
however i have a question please:
if i write an SP with an OPTIONAL filter like this:
(input param) DepartmentCode INTEGER;
...
select bla
from bla
join depts d
where ((:departmentcode is null) or (d.code = :departmentcode))
does the last line here mean the SP is not optimised as i am
dynamically changing the where clause depending upon whether the
user has specified a filter or not?
is SPs the way to go do you think?
thanks
i am writing a reporting application and am considering how best to
get the data from the firebird 1.5 database. my reports all contain
user selectable filters. as far as i can see my 2 options are SPs or
to construct dynamic SQLs. my preferred route is definetely SPs,
however i have a question please:
if i write an SP with an OPTIONAL filter like this:
(input param) DepartmentCode INTEGER;
...
select bla
from bla
join depts d
where ((:departmentcode is null) or (d.code = :departmentcode))
does the last line here mean the SP is not optimised as i am
dynamically changing the where clause depending upon whether the
user has specified a filter or not?
is SPs the way to go do you think?
thanks