MySQL Forums
Forum List  »  Perl

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.

Options: ReplyQuote


Subject
Written By
Posted
B A
August 04, 2011 09:40AM
August 04, 2011 01:14PM
Re: INSERT in Perl
B A
August 04, 2011 03:20PM
September 08, 2011 01:47PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.