Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-16 07:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found