 |
|
Home:
Perl Programming Help:
DBI:
Re: [streamlineIC] Passing dates as variables:
Edit Log
|
|

roolic
User
Apr 14, 2010, 8:54 PM
Views: 4915
|
|
Re: [streamlineIC] Passing dates as variables
|
|
|
if we are talking about the oracle the date field types should checked via oracle to_date() function call see here http://www.techonthenet.com/oracle/functions/to_date.php
my ($startdate, $enddate) = ('05-04-2010', '11-04-2010') ; my $stmtRecs = "SELECT * FROM test_table WHERE create_date_time BETWEEN to_date(?,'MM-DD-YYYY') AND to_date(?,'MM-DD-YYYY')"; my $sth = $dbh->prepare($stmtRecs); $sth->execute($startdate, $enddate) or die $dbh->errstr; generally it's more comfortable for perl to use *nix timestamp (db field type is unsigned integer not "date") instead of db's date which is hard to convert.
(This post was edited by roolic on Apr 14, 2010, 9:06 PM)
|
|
|
Edit Log:
|
|
Post edited by roolic
(User) on Apr 14, 2010, 9:04 PM
|
|
Post edited by roolic
(User) on Apr 14, 2010, 9:06 PM
|
|
|  |