Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-08-19 20:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found