Re: NULL value
Posted in 1998
Topics: SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design
In article <362d97e3.29029560@news.seed.net.tw>, julie@.iii.org.tw (julie lin) wrote: > On Tue, 20 Oct 1998 18:22:23 +0100, Peter Lancashire > <Peter.Lancashire.PL1@bayer.co.uk> wrote: > > Helmut Leininger wrote: > > > > julie lin wrote: > > > > > Hello, > > > ... > > I know " WHERE mycol IS NULL " will work , but for some reason, > it'll be easier for me for using only dynamic SELECT statements (has > replacable parameters "?" in the where condition), I just wonder why I > can insert NULL data by using the following dynamic INSERT statement ? > > sprintf(insert,"insert into test values (?)"); > EXEC SQL prepare ss from :insert; > > /* create a sqlda structure bind , execute the query USING bind */ > > bind=(struct sqlda *)malloc(sizeof(struct sqlda)); > bind->sqlvar=(struct sqlvar_struct *)malloc(sizeof(struct > sqlvar_struct)); > bind->sqld=1; > bind->sqlvar->sqltype=CCHARTYPE; > bind->sqlvar->sqllen=3; > memset(input,'\\0',4); > bind->sqlvar->sqldata = input; > > EXEC SQL execute ss using descriptor bind; > > I had a similar problem and found the following Informix Product Defect for it: Description of Product Defect #84480 Product: ESQL/C Reported: 11/12/1997 ESQL HOST VARIABLES INCORRECTLY STORING EMPTY STRING VALUES IN VARCHAR DATATYPES AS NULL VALUES WHEN INSERTING INTO A DATABASE Verified in Fixed in Platform 7.22.UC1 - UNIX when a varchar host variable has a value of an empty string the value is being stored binarily as a null value. This occurrs on the insert operation. -----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum