On Fri, Jan 04, 2002 at 11:02:36AM -0500, David Dierauer wrote:
> But if what you want to get (and print) is "", would this (using NVL
> in the select statement) work? Or would "" returned from the database
> get interpreted by the DBI (or maybe by Perl itself) as undef?

That's a good point.  Although the ANSI standard says that '' is a valid
value, Oracle treats it as NULL.  Other databases do the right thing.


> Here's my clunky workaround for avoiding warnings about undef values (when
> I don't want to just say "no warnings 'uninitialized';" in that block):
> 
> while ( $sth->fetch )
> {
>    for my $each ( $field1, $field2 ) #-- any fields I'm fetching that might be null
>    {
>       $each ||= "";

That will change 0 to ''.  You probably want something like:

defined $each or $each = '';


Ronald

Reply via email to