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?


In reply to Re: Perl oracle insert error handling by Anonymous Monk
in thread Perl oracle insert error handling by homer4all

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.