I'm using DBI to interact with ORACLE . I have a number of statements
- select, insert, update, and delete - that are executed depending on
the logic.

When I execute the $handle->do statement, is the return code a simple
true or false as to whether the statement worked, or does the value
mean something more?

I'd like to be able to determine how many rows the statement acted
against.

For example, in one part of the code, I tried doing this:

    $drc = $handle->prepare ("DELETE FROM MyTable WHERE EMPNO = ?") or
do {
        print "DELETE prepare failed - $DBI::errstr\n";
        next;
    }
    $drc = $oraProdDBH->execute ($employee) or do {
        print "DELETE execute for $employee failed - $DBI::errstr\n";
        next;
    }
    if ($drc != 1) {
        if ($drc eq '0E0' or $drc == 0) {
                print "DELETE from MyTable for EMPNO $employee changed
0 rows\n";
        } else {
                print "DELETE from MyTable for EMPNO $employee changed
$drc rows\n";
        }
    }

thinking that I was logging useful information about the deletion.
However, it seems like I frequentlly see the "changed 0 rows" message
coming out at times when I should have seen a row deleted.

Is this the method of testing to see if, in this case, the DELETE
deleted any rows, and if so, how many? If not, what would be the way?
And would this other way handle updates as well?

Thank you so much for your help.

Reply via email to