Re: How to check for NULL values in ISQL
Posted in 1995
>From: Sally Woolrich <Sally@excelsis.demon.co.uk>
>Date: Fri, 13 Oct 95 14:36:40 GMT
>X-Informix-List-Id: <news.17935>
>
>In article <45lo6u$aqc@hazel.Read.TASC.COM>
> amiller@tasc.com "Andrew Miller" writes:
>
>> kcj@netcom.com (Kate Juliff) wrote:
>>
>> >How do I check for nulls in a column of type INTEGER?
>>
>> Use an indicator variable for the host variable you're selecting into. The
>> indicator variable will contain -1 if the field is NULL. See the "Indicator
>> Variables" section of "Programming with ESQL/C for Windows" for more details.
>
>This will show if the column *allows* NULLs, but not if it actually
>*contains* NULLs. If the later is what is required, the data will
>have to be searched in some manner.
I presume that the date when Sally's answer was posted had something to do
with the gremlins in it :-)
On the contrary, the indicator variable indicates whether the current value
is NULL or not; it does not indicate whether the column allows nulls or
not, and that information is not readily available except by interrogating
SysColumns and SysTables, a non-trivial exercise. DESCRIBE does not
provide that information.
Of course, the original question was about ISQL, so indicator variables are
of minimal relevance anyway -- they apply to ESQL/C only (not even I4GL).
I've seen a number of answers, most of which had some merit.
I'd summarise the solutions as:
* In SQL (or ACE):
SELECT KeyData FROM SomeTable WHERE IntegerColumn IS NULL;
* In Perform:
Query on the column using just an equals sign as the query condition.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>