MySQL Forums
Forum List  »  Perl

Re: INSERT in Perl
Posted by: Randy Clamons
Date: August 04, 2011 01:14PM

Since your statement doesn't return any rows, it doesn't need to be prepared. If you're doing multiple inserts like this you can prepare the statement, but not like that.

When you prepare a statement, you do that with placeholders, then when you execute you supply values for the placeholders. Placeholders are a question mark.

The insert would be something like this:
INSERT INTO $table (symbol,expn_dt,strike,open,bid,ask,last,volume) VALUES(?,?,?,?,?,?,?,?);

The execute:

$sth->execute($h1{'symbol'},$exp,$h1{'strike'},$h1{'open'},$h1{'bid'},$h1{'ask'},$h1{'last'},$h1{'volume'});

Or you could simply:

#sth->do($ins_rec);

It's not likely the $ins_rec is hampered by the strict. It must be a different variable in the interpolation that hasn't been declared previous to this statement. Make sure %H1 and $exp have both been declared prior to this statement.

Options: ReplyQuote


Subject
Written By
Posted
B A
August 04, 2011 09:40AM
Re: INSERT in Perl
August 04, 2011 01:14PM
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.