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"; } }

In reply to Handling Null or Undef values in DBI (and things of those nature)... by data67

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.