Subject | Re: [firebird-support] Optional FOR SELECT-WHERE parameters |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2008-08-23T07:24:06Z |
You can of course do
for select...
from....
where FIELD1 = coalesce(:PARAM1, FIELD1) and FIELD2 = ....
into....
do...
but note that no index can then be used for FIELD1, so you probably do
not want to do this to every field for large tables.
HTH,
Set
sdbeames wrote:
for select...
from....
where FIELD1 = coalesce(:PARAM1, FIELD1) and FIELD2 = ....
into....
do...
but note that no index can then be used for FIELD1, so you probably do
not want to do this to every field for large tables.
HTH,
Set
sdbeames wrote:
> Hi all,
> is there a way to ignore certain input parameters to my selectable
> S.P. that are used in a FOR SELECT loop WHERE filter, if they are null?
>
> ie if PARAM1 IS NOT null.....
>
> for select...
> from....
> where FIELD1 = :PARAM1 and FIELD2 = ....
> into....
> do...
> ---------------------------------
> or if PARAM1 IS null....
>
> for select...
> from....
> where FIELD2 = ....
> into....
> do...
>
> I'm unsure if a FOR EXECUTE STATEMENT approach would be wise with a
> large FOR SELECT statement inside.
>
> FB1.5
> Thanks,
> Steve