Subject Re: [ib-support] Select
Author Helen Borrie
At 12:42 PM 13-05-02 +1200, Sandeep wrote:
>I have a stor proc as follow
>select valueA from tableA where fieldA = 2 into :varA;
>select valueA from tableA where fieldA = 1 into :varA;
>if first statement finds something then varA is set to that value. And if
>the second statement doesn't find anything then I expected it to be set
>to null, but that's not the case. It has the value assigned in first select
>Is this OK ?

If you were expecting something to change varA under these conditions then
I guess it is not OK. <g> The only situation here where you would get a
change in varA to null would be if "select valueA from tableA where fieldA
= 1" found a row and valueA was null. If it doesn't find a row at all,
that won't reset the variable. All your code is saying is "if there is
such a row, then push the value of valueA into varA. If you want it to be
null in the event that no row is found, code it by initialising varA to
null *before* calling select...into


All for Open and Open for All
Firebird Open SQL Database · ·