In a perl script I have inherited:

:
some setup
:
# logon to Oracle
$oraProdDBH = DBI->connect("dbi:Oracle:", $user_name, $password)
    or die "Failed to connect to $DBI:errstr\n";


$oraProdDBH->{RaiseError} = 1;
:more stuff
:
and subsequent statement handles created and invoked. When the insert
sql is invoked, the data gets into the tables. Also, if some of the
input data doesn't match oracle's column data type/size for the table,
an error is raised,
just as I expect.


Likewise, when deletes occur, the data is deleted.


The question comes in with the update statements. The update
statement
says:


    $oraProdDBH->do
    (
        "UPDATE CSI_SECURITY SET " .
            "LAST_NAME=" . $oraProdDBH->quote ($employee->[1]) . ",
" .
            "FIRST_NAME=" . $oraProdDBH->quote ($employee->[2]) . ",
" .
            "INITIALS=" . $oraProdDBH->quote ($employee->[3]) . ",
" .
            "PREFERRED_NAME=" . $oraProdDBH->quote ($employee->[4]) .
", " .
            "DEPT_NO=" . $employee->[5] . ", " .
            "EMP_STATUS=" . $oraProdDBH->quote ($employee->[6]) . ",
" .
            "REC_MOD_DATE=SYSDATE " .
        "WHERE " .
            "PERSON_ID=" . $employee->[0]
    );


Now, when the PERSON_ID matches, the update occurs.  When the
PERSON_ID is not found, however, an error isn't raised.


Should an error be raised? If not, then I guess I need to do a select
first to see if the item exists? Or is there something I can check in
the DBI handle  that will tell me that the operation applied to 0
rows?


Reply via email to