Subject | Re: [firebird-support] Re: Empty Result Set / NULL handing |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2007-04-11T07:21:21Z |
Adam wrote:
Variable = 'EOF';
Select value from table where id = someidnumber and value is not null
into :variable;
for this latter suggestion to be equivalent.
Set
> --- In firebird-support@yahoogroups.com, "slalom91" <slalom91@...> wrote:In case of NULL in the value field, I think he would need
>> I had a stored procedure similar to the following:
>>
>> ----
>> Select value from table where id = someidnumber into :variable;
>>
>> If (variable is null) then
>> result = 'EOF'
>> else
>> result = variable;
>>
>> ----
>> In FB 1.5 this was working when the result set was empty. However,
>> with FB 2.0.1 it is not.
>
> If it was working in 1.5 you were extremely lucky.
>
> If the result set of your query is empty, the variable will not be set
> to null. It won't be set at all.
>
> Before your select, you need to say.
>
> Variable = null;
>
> Or you could simplify the whole thing.
>
> Variable = 'EOF';
> Select value from table where id = someidnumber into :variable;
Variable = 'EOF';
Select value from table where id = someidnumber and value is not null
into :variable;
for this latter suggestion to be equivalent.
Set