How to: Timestamp to Date string OCONV

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
MrBlack
Participant
Posts: 125
Joined: Wed Aug 08, 2012 8:57 am

How to: Timestamp to Date string OCONV

Post by MrBlack »

Datastage isn't behaving how I thought it would.

[Source]
Oracle date column which has the ability to also have a time component on it. In datastage this is defined as a timestamp to preserve the time.

[Destination 1]
CSV file. Columns specified as a varchar(10). In the transformer I do a

Code: Select all

LEFT(OCONV(DSLink1.col1, "D/MDY[2,2,4]"), 10)
but my data comes out in "D-YMD[4,2,2]" format which leads me to believe that the OCONV function isn't working. Also if I take off the LEFT() I get the full date time string.

[Destination 2]
Oracle Date column defined as a timestamp in Datastage to preserve the time aspect. If it wasn't for this destination I would TRUNC() my data column and then I think I could get the OCONV function to work.

I've been trying all sorts of variations. The next thing I thought to try is to wrap everything into and ICONV and then OCONV a second time but I thought I'd get this post out there in case there was a better way to do things. Or another idea would be in my SQL cast the column as a varchar and deal with this info as a string.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try changing the Data Element for this column to Date.
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