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