One problem that jumps out at me is the ; that you added to the end of your SQL statement. For clarity's sake, let's break this down a bit by separating the SQL from the $sth, and fixing that extra semi-colon. If I were you, I would also unquote the numbers if they are going into a numeric field, and also use place-holders.

my $sql = " INSERT into Standard_population ( Standardisation_type, Male_00_04, Female_00_04, Male_05_09, Female_05_09, Male_10_14, Female_10_14, Male_15_19, Female_15_19, Male_20_24, Female_20_24, Male_25_29, Female_25_29, Male_30_34, Female_30_34, Male_35_39, Female_35_39, Male_40_44, Female_40_44, Male_45_49, Female_45_49, Male_50_54, Female_50_54, Male_55_59, Female_55_59, Male_60_64, Female_60_64, Male_65_69, Female_65_69, Male_70_74, Female_70_74, Male_75_79, Female_75_79, Male_80_84, Female_80_84, Male_85_plus, Female_85_plus) VALUES( 'EuropeanStandard', '8000', '8000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '7000', '6000', '6000', '5000', '5000', '4000', '4000', '3000', '3000', '2000', '2000', '1000', '1000', '1000', '1000')"; my $sth = $dbh->prepare($sql) or die $dbh->errstr; $sth->execute() or die $dbh->errstr; $dbh->commit();

In reply to Re: Perl DBI Insert row by Itatsumaki
in thread Perl DBI Insert row by Win

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.