Searching for zero-length strings in E/SQL
Posted in 1994
I'm using Informix On-Line 5.0, on a Sun 4 with SunOS 4.1.3
I have an interesting problem with E/SQL. I have a simple program
that uses a host variable value to search for a zero-length string
in a database column, for example
select t1_key from table1 where t1_desc = ''
If I run this statement from isql, it finds all the rows where I've
entered '' for the string column "t1_desc". If I create a statement
in E/SQL like this:
select t1_key FROM table1 WHERE t1_desc = ''
it finds the rows correctly. But if I create the statement like this:
select t1_key FROM table1 WHERE t1_desc = ?
and use a host variable that is set to a zero-length string, it
searches for NULL instead.
I've talked to Informix support, and they say that if the host
variable is set to '', then it will search for NULL, instead
of a zero length string, but if I set the host variable to a
single space, then it will find the rows with a zero-length string,
and that this is working correctly.
Does this sound right?
Any information would be great.
--
Mark E. Hansen internet: meh@Unify.Com
Unify Corporation ...!{csusac,pyramid}!unify!meh
3901 Lennane Drive voice: (916) 928-6234
Sacramento, CA 95834-1922 fax: (916) 928-6401
** If there is no solution, there is no problem **