|
|
Archives of the TeradataForum
Message Posted: Wed, 14 Feb 2001 @ 22:41:45 GMT
Subj: | | Re: Datediff function |
|
From: | | Mark Landry |
Phillipp raises a related question... is there any way that DBD::Teradata (the official name of Dean's Perl DBI Teradata driver) can
return the ANSI date format instead of the native Teradata integer form without cast-ing in the query?
Here's a small code sample for those interested:
use strict;
use DBI;
use DBD::Teradata;
my $opt = {RaiseError => 1, ChopBlanks => 1};
my $tdh = DBI->connect( 'DBI:Teradata:dbccop1', 'user', 'passwd', $opt)
|| die $DBI::errstr;
my $tdsth = $tdh->prepare(
"select current_date,
cast(current_date as char(10)),
current_date - date '2001-01-01'" );
$tdsth->execute();
while( my @row = $tdsth->fetchrow_array() ) {
print "@row\n";
}
$tdsth->finish();
$tdh->disconnect();
__END__
$ perl TDdatediff.pl
1010214 01/02/14 44
$
| |