Re: INSERT in Perl
Posted by:
B A
Date: August 04, 2011 03:20PM
thanks Randy,
going with the place-holders, I have:
my $ins_rec="INSERT INTO $table (symbol,valuation_dt,expn_dt,strike,open,bid,ask,last,volume) VALUES(?,?,?,?,?,?,?,?,?);";
my $sth=$dbh->prepare($ins_rec);
$sth->execute(\'$h1{'symbol'}\',now(),\'$exp\',$h1{'strike'},$h1{'open'},$h1{'bid'},$h1{'ask'},$h1{'last'},$h1{'volume'});
and I get the following error:
Bad name after symbol' at otest2.pl line 54.
line 54 being the execute statement....
EDIT:
I fixed it.....I removed the \'...\' around symbol and $exp and it worked.
It doesn't work with now()....how do I replace now() with today's date in the statement?
Edited 1 time(s). Last edit at 08/04/2011 03:59PM by B A.