From: "Eko Budiharto" <eko.budiha...@gmail.com>
Subject: [ask] oracle date


> dear list,
> I have a date data extracted from oracle, stored as this 1993-11-30 
> 00:00:00. The datatype in the oracle is date. I would like to save into 
> mysql (the datatype is also date), I got an error. When I do a small 
> debug, I print the date directly, it comes out into 30-NOV-93. I am 
> trying to use date::manip, time::format, date::format, it still got an 
> error and cannot be saved into mysql.
> 
> Please help to tell me how to convert the date format and can be stored 
> into mysql. Thanks.
> 
> 
> Eko



After you connect to Oracle, you need to send the following sql queries in 
order to changed the format in which it returns the date fields:

alter session set nls_date_format = 'YYYY-MM-DD HH24:MI:SS';
alter session set nls_timestamp_format = 'YYYY-MM-DD HH24:MI:SS.FF';
alter session set nls_timestamp_tz_format='YYYY-MM-DD HH24:MI:SS.FF TZHTZM';

After you do this, the dates will be returned in the same format as the one 
used by MySQL, so you don't need any Perl module to parse the date fields.

Octavian







--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to