Perl Forum for Beginners

[ask] oracle date

Mar 10, 2012 5:27 am
Eko Budiharto

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

Mar 10, 2012 6:01 am
Octavian Rasnita
Re: [ask] oracle date

From: "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



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
--0-876498840-1232476614=:99796
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

ERROR:=0Asth->fetchrow_array=C2=A0fails with ODBC (DBD::ODBC) connection to=
SQL Server but works fine with ORACLE using DBDOracle.=C2=A0 See error bel=
ow...
Any Oracle DBA Around ???? - Perl DBI of Oracle Enterprise Manager (OEM) Install
Hi all,

We currently have OEM installed but will have to uninstall it due to
Oracle Licensing issues. Customers do not want to pay
for the performance and diagnostic pack and are actually considering
to move to SQLServer .. :-)

Anyway, am wanting to try out and install oracletool or...
Date calculation help/suggestion please ... when there is no Date or Time module available
--001636c5be089c20670483af709d
Content-Type: text/plain; charset=ISO-8859-1

Hi all,

I have a Perl script on Windows that does date calculation and using
Date::Calc, Decode_Month and Delta_YMDHMS functions

Am using the script to calculate the difference between two dates, for
example,...
DBD::Oracle error
--0016e64355e084915b046bfa841f
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hi list
when I am running a perl code which uses DBI and DBD::Oracle I am getting
the following error

DBD::Oracle initialisation failed: Undefined subroutine...
DBD Oracle Assistance
------_=_NextPart_001_01CAFB84.B5DA4AD6
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

All

I have a perl script that connects to Oracle 10.2 database.

=20

I have a very simple insert statement that inserts data into a table
within a...
Oracle nightmare
Hi all

I have already lost one day around coding and documentation with this
problem, so I'm asking for help with DBD::Oracle.

I'm working around the unicode and BLOB problem. Can someone help me
setting the fooling code running and correctly undling the Unicode
part

use strict;
use...
Perl2exe and DBI, DBD::Oracle modules
------_=_NextPart_001_01C9A18A.6F1D37E9
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi All,

=20

I have one perl script which connects to oracle db and run some queries
and get the job done. The initial code is as followed...
Re: Oracle DBA's group mail ids'
--001636e0aa5e8c374704a0c915dd
Content-Type: text/plain; charset=ISO-8859-1

Dear friends,

awaiting for your reply . can you please someone advis me on this please

On Tue, Apr 12, 2011 at 4:12 PM, Raveen du <raveendu.oracledba@gmail.com>wrote:

> Dear Friends,
> ...
Problem with dbi oracle blob
--_009_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mirab_
Content-Type: multipart/alternative;
boundary="_000_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mirab_"

--_000_04AAC626111C2B41BCBB54D144C76AA7010B8629MIRAMAIL10mirab_
Content-Type: text/plain;...
Script to test connecting to Oracle DBs
--bcaec54a325220761504c5d9fb2c
Content-Type: text/plain; charset=ISO-8859-1

Hi all,

I am looking for a Perl script or something similar that I can use to test
connection from a client PC to several databases on a server.

Does anyone know of any such script lying around somewhere...