CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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



roolic
User

Apr 14, 2010, 8:54 PM


Views: 5671
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


Code
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


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives