I don't know the schema for your DB. But in general, you will get a NULL for for a blank field instead of undef, but there are exceptions. There are "rules" for the fields that are specified when the table is created.my $sth = $dbh->prepare("select NAME from data_template_data"); my $results = $sth->execute() or die "execute failed"; # the return value from $sth->execute() will be undef # if the query failed...otherwise the $results value # will contain the number of lines in that result set # # The DBI will return "0E0" to mean a true value with # a numeric result of "zero" to differentiate between # "didn't work" (undef) and "worked, but returned no rows" # this is the "logically true, but numeric false value". #To get the rows, use a while() loop.. # while ( (my $name) = $sth->fetchrow()) { print "name is $name\n"; }
If you can give me some data, I can create a MySQL DB on my server and help you further.
Don't go "crazy", just give me 5-10 lines or so.
In reply to Re: Perl DBI NULL and undef
by Marshall
in thread Reaped: Perl DBI NULL and undef
by NodeReaper
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |