baperl has asked for the wisdom of the Perl Monks concerning the following question:
and when I run it, I get the following message:my $tdate = $fields[0]; print "$tdate\n"; my $trade_dt=UnixDate($tdate,"%Y-%m-%d"); # my $trade_dt = DATE(\"$tdate\"); print "$trade_dt\n"; my $ins_rec = "INSERT IGNORE INTO $tblname(\`trade_dt\`,\`symbol\`) va +lues (?,?);"; my $sth=$dbh->prepare($ins_rec); $sth->execute($trade_dt,$symbol); $sth->finish;
any thoughts on how I can fix it....it is obviously reading the date correctly from the file as the print statement shows the correct date, but I am obviously making an error in the INSERT statement."10/14/2011" Use of uninitialized value $trade_dt in concatenation (.) or string at + Set.data.pl line 42, <FIN> line 1.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: inserting date into mysql
by Corion (Patriarch) on Oct 16, 2011 at 19:13 UTC | |
|
Re: inserting date into mysql
by AnomalousMonk (Archbishop) on Oct 16, 2011 at 23:00 UTC | |
by NetWallah (Canon) on Oct 17, 2011 at 06:02 UTC |