Subject | RE: [IBO] Null parameter |
---|---|
Author | Jerry Sands |
Post date | 2008-07-04T05:05:56Z |
I believe Helen answered that, to get the stored procedure called with the
"ItemRef" value being a null, you use "Query.ParamByName('ItemRef').Clear"
Jerry Sands
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Robert martin
Sent: Thursday, July 03, 2008 11:36 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Null parameter
Hi
recognises NULL - and this
You misunderstand my original question. what I meant was that I could
changed the SQL the query was using between
SELECT *
FROM MyStoredproc(:ItemRef)
And
SELECT *
FROM MyStoredproc(NULL)
Which would require re preparing.
it the way you showed above. You must have variable or property, not
something hard-coded....e.g.
BeforeOpen, assign it like this:
it empty (not assigning) a value to the parameter in the past but to no
avail. I did not know that clearing the param would be the same as
passing null. Makes sense. That's all I needed to know :)
Thanks
Rob
[Non-text portions of this message have been removed]
"ItemRef" value being a null, you use "Query.ParamByName('ItemRef').Clear"
Jerry Sands
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Robert martin
Sent: Thursday, July 03, 2008 11:36 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Null parameter
Hi
> First of all, you don't have to "reprepare etc" to pass a differentparameter value. All you need to do is figure out how your application
recognises NULL - and this
You misunderstand my original question. what I meant was that I could
changed the SQL the query was using between
SELECT *
FROM MyStoredproc(:ItemRef)
And
SELECT *
FROM MyStoredproc(NULL)
Which would require re preparing.
> entirely depends on how you're getting the values forQuery.ParamByName('ItemRef').AsInteger. I'm sure you don't actually assign
it the way you showed above. You must have variable or property, not
something hard-coded....e.g.
>Yes I am doing that in code.
> Query.ParamByName('ItemRef').AsInteger := SomeIntegerVar;
>
>
> Decide on some value for SomeIntegerVar that's not ever going to be usedas an input value, say -99 if your input is always positive. Then, in your
BeforeOpen, assign it like this:
>I know when I want to set it as null just not how. I have tried leaving
> if SomeIntegerVar >= 0 then
> Query.ParamByName('ItemRef').AsInteger := SomeIntegerVar
> else
> Query.ParamByName('ItemRef').Clear;
>
>
it empty (not assigning) a value to the parameter in the past but to no
avail. I did not know that clearing the param would be the same as
passing null. Makes sense. That's all I needed to know :)
Thanks
Rob
[Non-text portions of this message have been removed]