Re: insert empty strings in ESQL/C
Posted in 1998
ProzessDV wrote: > > OWS 7.22 on SCO UNIX, embedded SQL: > > How can I insert an empty string, stored in a hostvariable (hostvar = "\\0"), > into a column without getting a NULL value as a result as I have got so before? Just insert a string containing a single space. The engine assumes that any string with a NULL first character is a NULL string. When you store a string that contains a single space into the database it will be expanded to space filled and returned as an empty, but non-null string. Except for varchars Informix allways space fills strings anyway so inserting a single space is just a bit faster way of storing and all blank or empty string. If you fetch that row back into a host variable declared as type 'string' you will get a normal "C" Null string (ie string[0] = NULL) but an indicator on the column will not show the column as being NULL. Art S. Kagel