David,

Does you database support a function which will convert a null value to some other 
character (i.e. NVL() in Oracle)?  If so, use it where appropriate, otherwise use 
something like:

printf "%s\n", (defined $col ? $col : "NULL);

-----------------
Ron Reidy
Senior DBA
Array BioPharma, Inc.


-----Original Message-----
From: David N Murray [mailto:[EMAIL PROTECTED]
Sent: Monday, April 26, 2004 9:26 AM
To: Jesse, Rich
Cc: [EMAIL PROTECTED]
Subject: Re: Correct way to deal with returned NULLs?


$dateclosed = '' if !defined($dateclosed);

On Apr 26, Jesse, Rich scribed:

> Howdy,
>
> I have a question from one of our developers that's been bugging me and I
> can't find an answer.  Given this v1.37 DBI code fragement:
>
> while ( my ($projectno,$description,$dateclosed) = $sth->fetchrow_array )
> {
>       print "$projectno";
>       print "$description";
>       print "$dateclosed";
>       print "\n";
> }
>
> ...I keep getting a "Use of uninitialized value in string" message on the
> print of the $dateclosed variable, whenever the corresponding Oracle DB
> column is NULL.  And you've already figured out that the program is run with
> "-W".  When the "-W" is dropped, no message.
>
> This has got to be simple, but a read through the DBI FAQ, the index of
> Tim's book, and Google, and I'm still unable to provide a simple answer
> that's probably staring me in the face, other than "Drop the -W".
>
> How do others deal with this?
>
> TIA,
> Rich
>
> Rich Jesse                        System/Database Administrator
> [EMAIL PROTECTED]      QuadTech, Sussex, WI USA
>

This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended 
to be for the use of the individual or entity named above. If you are not the 
intended recipient, please be aware that any disclosure, copying, distribution 
or use of the contents of this information is prohibited. Please notify the
sender  of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.

Reply via email to