Mar 10, 2012 5:27 am
Eko Budihartodear 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
Mar 10, 2012 6:01 am
Octavian RasnitaFrom: "Eko Budiharto" <eko.budiharto@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
> 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
Previous Thread: Insert a . every four characters
Next Thread: How can I extract the lines after A
Related Forum Topics
- Fetchrow_array fails with SQL Server DBD::ODBC connection but ok with Oracle DBDI::Oracle
- Any Oracle DBA Around ???? - Perl DBI of Oracle Enterprise Manager (OEM) Install
- Date calculation help/suggestion please ... when there is no Date or Time module available
- DBD::Oracle error
- DBD Oracle Assistance
- Oracle nightmare
- Perl2exe and DBI, DBD::Oracle modules
- Re: Oracle DBA's group mail ids'
- Problem with dbi oracle blob
- Script to test connecting to Oracle DBs