in reply to Handling conditions DBI in Oracle 8.1
my $found = $dbh->selectrow_arrayref(q{ select 1 from employee where employee_number = ? },undef, $search_for_id); <do something> unless $found->[0]; # now get the record
The idea is to first see if the the row with that id number is indeed there. If not - exit, die, next, last - whatever will keep the flow going for your code. Also, i am using placeholders in the example - this keeps you from having to call the DBI::quote method, but it is not portable for ALL database vendors (just most).
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR F--F--F--F--F--F--F--F-- (the triplet paradiddle)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Handling conditions DBI in Oracle 8.1
by runrig (Abbot) on Jan 15, 2002 at 22:13 UTC |