Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Perl DBI Insert row

by Itatsumaki (Friar)
on Nov 26, 2003 at 18:07 UTC ( #310343=note: print w/replies, xml ) Need Help??

in reply to Perl DBI Insert row

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();

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://310343]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2020-05-28 22:26 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (166 votes). Check out past polls.