How to insert Timestamp with nano seconds in Oracle table

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
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

How to insert Timestamp with nano seconds in Oracle table

Post by Veni »

Hi

I have a input text file which have timestamp in this format (yyyymmddhhmiss+nano sec ) value is like this (200512161015222323).

My requirement is how t move this value to the oracle timestamp attribute.

Which function i should use in transformer

My output should be like - 16/12/2005 10.15.22.2323 in oracle table

Please suggest me how to solve this .

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

Post by ArndW »

Veni,

what have you tried to do so far that didn't work?
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

I tried with the Oconv and substrings fuctions but none of them is working.

Please guide me .
rv
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I would do it with either the ICONV & OCONV combination or substrings; both will work efficiently and accurately.

If your input data is always correct in the format yyyymmddhhmiss+nano sec and your output is in the form dd/mm/yyy hh.mm.ss.mmmm

then your derivation would start off with the date portion looking like:

Code: Select all

In.Col[7,2]:'/':In.Col[5,2]:'/':In.Col[1,4]
Veni
Participant
Posts: 45
Joined: Fri Oct 21, 2005 2:51 am

Post by Veni »

Is OCI bulk load will support the nano second , because in this stage date default option nano second is not available
rv
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Was that a question or an assertion? I'm not quite sure what you mean.
clshore
Charter Member
Charter Member
Posts: 115
Joined: Tue Oct 21, 2003 11:45 am

Post by clshore »

Not to be picky, but nano seconds are .000000001 of a second.
With format YYYYMMDDhhmmss+xxxx, you are dealing with tenths of milliseconds (or hundreds of microseconds), not nanoseconds.

Nano seconds would be like YYYYMMDDhhmmss+xxxxxxxxx.

Carter
DataStageCnu
Participant
Posts: 37
Joined: Sun Aug 01, 2004 1:18 am

Post by DataStageCnu »

ArndW wrote:I would do it with either the ICONV & OCONV combination or substrings; both will work efficiently and accurately.

If your input data is always correct in the format yyyymmddhhmiss+nano sec and your output is in the form dd/mm/yyy hh.mm.ss.mmmm

then your derivation would start off with the date portion looking like:

Code: Select all

In.Col[7,2]:'/':In.Col[5,2]:'/':In.Col[1,4]
HI all

I believe, the question is not ment to convertion in DataStage. The intension would be,.. How to load in oracle table. What data type has to be decleared for this format(dd/mm/yyy hh.mm.ss.mmmm).... Correct me, if i am wrong.

Cnu
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Assuming the target field is a TIMESTAMP and not a DATE, you'd need a couple of things. First a VarChar field to hold it inside the job and then User Defined SQL to issue the TO_TIMESTAMP() as that datatype is not yet officially supported.

That's an opinion, btw, never had to actually deal with them myself as of yet.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Given that everything's in the correct sequence, the Fmt() function with a mask seems to me to be an easy solution. The first example loses the fractional seconds, the second example keeps six digits' worth of them.

Code: Select all

Fmt(Inlink.TheCol, "L####-##-## ##:##:##")
Fmt(Inlink.TheCol, "L####-##-## ##:##:##.######")
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