Subject | Re: [IBO] Parameterized WHERE clause |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-05-16T10:13:58Z |
Hi Eric!
didn't reply since I expected others to jump in. Having seen Geoffs reply,
I thought again and I think your particular problem can be easily solved by
introducing an extra parameter. Simply use
WHERE (ACTIVITYKEY=:AKEY OR 1=:MYBOOLEAN) AND AMODE=0
and set MyBoolean to 1 when you don't care about the value of ActivityKey.
The negative side of this approach is that no index for ActivityKey will be
used.
I hope I haven't gotten confused about null values this time (Null or True
ought to equal True).
HTH,
Set
>Is there any way to parameterize this WHERE clause so it only getsWhen I saw your question, I thought about using the SQLWhereItems, but
>prepared once and I don't have to re-enter the SQL?
didn't reply since I expected others to jump in. Having seen Geoffs reply,
I thought again and I think your particular problem can be easily solved by
introducing an extra parameter. Simply use
WHERE (ACTIVITYKEY=:AKEY OR 1=:MYBOOLEAN) AND AMODE=0
and set MyBoolean to 1 when you don't care about the value of ActivityKey.
The negative side of this approach is that no index for ActivityKey will be
used.
I hope I haven't gotten confused about null values this time (Null or True
ought to equal True).
HTH,
Set