in reply to Perl oracle insert error handling
Since you've got several syntax errors that prevent your code from even compiling, I'm guessing you're fairly new to Perl. In that case, I think you've put too much on your plate to start with. You can fix a lot of the issues with the code yourself; take a step back and approach the problem step by step. For example, Step 1: connect to the database. Put this in a script and attempt to run it:
use warnings; use strict; use Text::CSV; use DBD::Oracle; my $exitStatus = 0; # Connect to database and disable autocommit my $dbAgent = OracleAgent->dbLogin(dbName); $dbAgent->connect(); $dbAgent-> setAutoCommit(0);
Try to run it: Does it work, or does it print an error? If it prints an error, try to fix it, or post it here if you can't figure it out on your own. Then, Step 2, add the following to the file:
foreach my $file (@csvFile) { chomp ($item); &insertRecords($file); } sub insertRecords { my $fileToInsert = shift; }
Again, try to run it, and fix the problems as they show up. And so on.
Also, remember the Basic debugging checklist, and if you need help fixing individual problems, remember How do I post a question effectively?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl oracle insert error handling
by homer4all (Acolyte) on Dec 23, 2014 at 17:28 UTC | |
by poj (Abbot) on Dec 23, 2014 at 17:35 UTC | |
by homer4all (Acolyte) on Dec 23, 2014 at 18:24 UTC | |
by Anonymous Monk on Dec 23, 2014 at 23:57 UTC |