The idea here is that I am trying to build this array so I can then spin through the array and insert each of these rows into an Oracle table.

If your @dlr_loc array is really small, as you seem to suggest, you can supplement the array within the sql statement, if that seems appropriate:

my $ordtype = 'SEASONAL'; # ... my $sql = "insert into that_table (a_col, b_col, c_col, d_col, e_col) +values (?,'US','M10','WEDNESDAY',?)"; my $sth = $dbh->prepare( $sql ); for my $a_val ( @dlr_loc ) { $sth->execute( $a_val, $ordtype ); }
Of course, if other fields turn out to be variables (and if you actually end up with a nested loop structure), that's fine -- just use more "?" placeholders in the sql statement.

OTOH, if you are going to be inserting a lot of rows (e.g. tens of thousands or more), your best bet is to use your perl script to create a tab-delimited text file containing the field values row-by-row (line-by-line), then invoke "sqlload" (or "sqlloader"?) -- the native Oracle data-import utility -- to actually load the contents of the file into the database. That will go a lot faster than using Perl/DBI to execute a long series of "insert into ..." statements (and the error-handling done by sqlload(er) will generally much better than you'd want to do yourself in Perl).


In reply to Re: Multidimentional array help by graff
in thread Multidimentional array help by sasrs99

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.