Re: perl+varchar in informix and oracle
Posted in 2008
dcruncher4@aim.com wrote: > No I am not starting a flame war here. > > I found something strange while using perl dbi. > > We have some rows in a varchar(80) not null column, where the user > has entered a single space to beat the not-null constraint. While > fetching it via Perl DBI, the single space gets truncated and > perl gets '' in the $ variable. The only way to distinguish that > with a null varchar value is that the $ variable is set to defined > in case of single space and undefined in case of NULL. I've done a fair bit of Perl DBI programming and never come across this problem. What method are you using for your fetch? Could you post a code snippet? Your Perl version is old, are you using the latest Perl DBI? What about DBD-Informix? Please post versions. Also the space to beat the not null constraint is not required by the database. An empty string could be used, this is different from a null. Ben.