date conversion

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
dnat
Participant
Posts: 200
Joined: Thu Sep 06, 2007 2:06 am

date conversion

Post by dnat »

Hi,

I have the following date value in the input file 07/31/2008 10:00:34
When i try to load it into the oracle table it is giving me insert error. what is the format to convert using iconv and oconv.

Thanks!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What stage are you using and what is your Oracle instance's default date format?
dnat
Participant
Posts: 200
Joined: Thu Sep 06, 2007 2:06 am

Post by dnat »

i am using the transformer stage.

And the oracle's default date format is

SQL> select sysdate from dual;

SYSDATE
---------
11-AUG-08
dnat
Participant
Posts: 200
Joined: Thu Sep 06, 2007 2:06 am

Post by dnat »

i tried to convert the input format to yyyy-mm-dd hh24:mi:ss using substring in transformer stage and it worked. but i think substring might take longer time than iconv-oconv. so i am trying to convert using iconv.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You're going to need substring, because you have to convert your date and time separately. In your case the time component does not require conversion so may simply be appended to the converted date.

Code: Select all

Oconv(Iconv(Field(InLink.TheTimestamp," ",1,1),"DMDY"),"D-YMD[4,2,2]") : " " : Field(InLink.TheTimestamp," ",2,1)
That said, Iconv()/Oconv() is a safer approach because it automatically handles single-digit month and day values (if specified as above and the source date has delimiters).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply