in reply to Re: Perl oracle insert error handling
in thread Perl oracle insert error handling
My database connection, inserting into database, committing record everything works
I will go with one problem at a time.My very first and most important problem is to have WHILE IF ($sth->err) loop working..I have changed my initial code little bit to move further.
somehow code doesn't like 2 close $fh; in the code and still logfile says 1 row commited where zero rows inserted actually.
while ($row = $csv->getline ($fh)) { $SQL1 = "Insert into TAB1 (sample_date, server, first, n1, n2) values (?,?,?,?,?)"; $sth = prepare($SQL1) $sth -> execute($row[0], $row[1], $row[2], $row[3], $row[4]); if ($sth->err) { $rc=0; $dbAgent->rollback(); close $fh; } $rc++; } close $fh; $dbAgent->commit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl oracle insert error handling
by poj (Abbot) on Dec 23, 2014 at 17:35 UTC | |
by homer4all (Acolyte) on Dec 23, 2014 at 18:24 UTC | |
|
Re^3: Perl oracle insert error handling
by Anonymous Monk on Dec 23, 2014 at 23:57 UTC |