I would strong recommend against doing this:
'$LINK_ID'
Unless you are absolutely certain that no values containing single quotes appear in the source data. Instead you should use the quote() method provided by DBI, or use placeholders.

I'm not sure if this will solve your problem, but if you would like to simplify the list of values being provided you could do something like this:

$dbh->{FetchHashKeyName} = 'NAME_lc'; my $val_loh = $dbh->selectall_arrayref($sql,{Slice => {}});
This will provide you with a list of hashrefs, with the keys of the hash being the lowercase version of the columns that were returned. In your example it could work like this:
use strict; use warnings; use DBI; my $dbh = DBI->connect($dsn,$username,$password) or die $DBI::errstr; # Request lowercase column names $dbh->{FetchHashKeyName} = 'NAME_lc'; my $sql_read = ''; # Whatever SQL you are using to select the records # Fetch a list of hashes. # The {Slice => {}} is an option provided to DBI that requests the lis +t of hashes my $val_loh = $dbh->selectall_arrayref($sql_read,{Slice => {}}); for my $row (@$val_loh) { print "link_id = $row->{link_id}\n"; my @columns = keys %$row; my @placeholders = map {'?'} @columns; my $sql_write = sprintf "INSERT INTO ORACLE_TABLE (%s) VALUES (%s) +", join(',',@columns), join(',',@placeholders); print $sql_write,"\n"; # Enable the following line after you confirm this code is correct # $dbh->do($sql,{},@{$row}{@columns}); }

In reply to Re: Syntax for list of scalars to be populated by fetchrow_array() ? by imp
in thread Syntax for list of scalars to be populated by fetchrow_array() ? by icskevin

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.