Update: Oh, and I agree w/below about doing a LIKE against a date (although it CAN work in Oracle, it is incredibly bad practice). It should be, e.g.:... WHERE date_column = TO_DATE(?, 'YYYY-MM-DD') ... my $date_str = '2015-08-08'; $sth->execute($date_str); # OR my $date_fmt = my $datetime_fmt = my $datetime_tz_fmt = 'YYYY-MM-DD HH +24:MI:SS'; $dbh->do("alter session set nls_date_format=$date_fmt"); $dbh->do("alter session set nls_timestamp_format=$datetime_fmt"); $dbh->do("alter session set nls_timestamp_tz_format=$datetime_tz_fmt") +; ... WHERE date_column = ? ... my $date_str = '2015-08-08'; $sth->execute($date_str);
Update: Fixed date fmt. Twice.$start_date = '2015-08-01'; $end_date = '2015-09-01'; ... WHERE date_column >= ? and date_column < ? ... $sth->execute($start_date, $end_date);
In reply to Re: Problem passing date to SQL
by runrig
in thread Problem passing date to SQL
by JoeTheProgrammer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |