String to timestamp in datastage 9.1.2

Posted on

Question :

Apologies for asking a question that I suppose is very basic. I’m just starting out with Streams.
I’m trying to read a sequential files containing a timestamp field and a value field, like this:


I want add this value to oracle 11g database as a timestamps. Is there any way in datastage 9.1.2 for this conversation…?

Result should be like below

150601172623+0530 -> 2015-06-01 05:26:23 PM
150601172041+0530 -> 2015-06-01 05:20:41 PM

Answer :

You can use TO_TIMESTAMP_TZ Function:

   TO_TIMESTAMP_TZ('150601172623+0530', 'RRMMDDHH24MISS+TZHTZM'), 
   TO_TIMESTAMP_TZ('150601172041+0530', 'RRMMDDHH24MISS+TZHTZM') 
FROM dual;

2015-06-01 17:26:23.000000000 +05:30   2015-06-01 17:20:41.000000000 +05:30

Leave a Reply

Your email address will not be published. Required fields are marked *