http://www.perlmonks.org?node_id=137005

data67 has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

Here is the deal guys. I am using DBI module with Oracle 8.1.7. (first timer) What i have is just an average web based interface for an oracle backend.
Two qestions:

1. How to handle my problem fields (empty fields?).
2. How to check if a record exists.

Question 1:
The problem is that when i try to pull in my data from the table my program crashes on the first field that is not defined.( i don't know if its a prblem with (NULL => undef ) or somthing else.

I have seen people use DBI::neat(undef) to handle similar thing and i tried that also with no luck, i still get "use of uninitialized value" message.
Here is what I have till now : (which by the way works good on records that have "all" fields filled.)

## connect to DB ## Run my SQL statements while (@row = $sth->fetchrow_array) { $employee_id = $row[0]; $last_name = $row[1]; $first_name = $row[2]; $cell_phone_number = $row[3]; $email = $row[15]; $information_date = $row[17]; ### clean up for web## eq ""); $last_name = " " if ($last_name eq ""); $first_name = " " if ($first_name eq ""); $cell_phone_number = " " if ($cell_phone_number eq " +"); $email = " " if ($email eq ""); $information_date = " " if ($information_date eq "" +); ## then print "$PRINT the "STUFF" retrieved"; ## disconnect


As you can see at the moment, this is really plain. Question 2:
I also want to find out "how?" i can check a the table before i add new records to it.

##somthing like so

check if record exists { if not present{ &add_new; } else { print " RECORD EXISTS"; } }