Re: NULL value
Posted in 1998
Helmut Leininger wrote: > > julie lin wrote: > > > Hello, > > > > I have a little ESQL/C program which fetchs data using dynamic binding > > method (has replacable parameters "?" in the where condition) , my > > problem is it fails to fetch NULL value if I bind the replacable > > parameters with a string containing only '\\0'. Why it doesn't work if > > informix indicates a character field containing a NULL as its value by > > > > storing a zero byte in the first character ? > > > > I'm using INFORMIX-ESQL Version 7.24.UC2 on AIX 4.2.1 > > > > Thanks! > > A NULL value does not match to any distinct value (and that's what you are > trying to do) by definition of SQL. It is only "by chance" that Informix > (unfortunately) indicates NULL values by storing a '\\0' in the leftmost > character (also in INTEGER etc.). > > Regards > Also, I bet your WHERE clause looks like this: WHERE mycol = ? whereas what you should write is: WHERE mycol IS NULL -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 --- If all else fails, read the instructions and the release notes. Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/ ---