Page 1 of 1

How to: Timestamp to Date string OCONV

Posted: Fri Apr 25, 2014 3:43 pm
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.

Posted: Fri Apr 25, 2014 4:27 pm
by ray.wurlod
Try changing the Data Element for this column to Date.