Timestamp 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
ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Timestamp Conversion

Post by ady »

This is the timestamp i need to convert to load into a OCI 9 stage. Can anyone tell me how to convert it ?... and also what is the ORACLE time stamp format ?

2006-11-22-11.36.51.535212



thanks
Last edited by ady on Tue Nov 28, 2006 8:58 am, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The answer depends on if you truly mean an Oracle TIMESTAMP field or are trying to populate an Oracle DATE field. The latter is supported natively by the OCI stages, the former is not. I'm assuming you really mean TIMESTAMP.

Since you'll need to fall back on User Defined SQL to leverage the TO_TIMESTAMP() function, your format doesn't really matter as long as it matches the mask in the function call. What you posted should be fine, depending on the precision of the TIMESTAMP field.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Post by ady »

I am getting the date mentioned above from a Complex flat file which shows the Native type as "character" and i need to load it into a OCI 9 stage where the table definition shows the field as "Timestamp".

Can i change the type in the OCI table definiton into "DATE" ?. It dosent work right ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Timestamp in DataStage is fine for loading into an Oracle DATE. You've confused me - is the Oracle field a DATE or a TIMESTAMP? Not in the job in the database.

If you are loading a TIMESTAMP then a Char or VarChar in the job should be fine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Post by ady »

I think the problem is with the length of the original date, it looks like "2006-11-22-11.40.11.801933" . i can get it to look like "2006-11-27 18:07:35 then i think it should work.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Answer the question re: the Oracle field - DATE or TIMESTAMP?

If you hack off the microseconds like you've just shown then it will load into either field, however you are doing yourself a disservice if you do that and load it into a TIMESTAMP field.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ady
Premium Member
Premium Member
Posts: 189
Joined: Thu Oct 12, 2006 12:08 am

Post by ady »

The Oracle field is "TIMESTAMP"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ok... then you are ok now? My first post talks about handling a true TIMESTAMP field, do you need more information or are there still doubts? As noted, you do not want to drop the microseconds.
-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 »

beaditya wrote:I think the problem is with the length of the original date, it looks like "2006-11-22-11.40.11.801933" . i can get it to look like "2006-11-27 18:07:35 then i think it should work.

Code: Select all

Left(InLink.TheString,10) : " " : Ereplace(Right(InLink.TheString,15), ".", ":", 2, 1)
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