Converting VarChar into Oracle Timestamp (Date)

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Childrensmn
Premium Member
Premium Member
Posts: 32
Joined: Mon Apr 12, 2010 3:42 pm
Location: Minneapolis
Contact:

Converting VarChar into Oracle Timestamp (Date)

Post by Childrensmn »

I have "NewDate" column coming from SQL Server as VarChar with the following format:
MM/DD/YYYY HH:MI
6/14/2014 16:07

I want to load this into Oracle table using Timestamp datatype (Its Date in Oracle).

Any pointers/help is appreciated.

Thanks!!
AshishDevassy
Participant
Posts: 32
Joined: Fri Nov 07, 2014 11:18 am

Post by AshishDevassy »

If its 'MM'/DD/YYY HH:MI shouldn't the data be 06.14.2014 16:07 ?
that's wierd ?
Childrensmn
Premium Member
Premium Member
Posts: 32
Joined: Mon Apr 12, 2010 3:42 pm
Location: Minneapolis
Contact:

Post by Childrensmn »

Here is how the data for that column is
6/14/2014 16:07
and
I want to load it in Oracle as Timestamp (Date) 'YYYY-MM-DD HH24:MI:SS'
AshishDevassy
Participant
Posts: 32
Joined: Fri Nov 07, 2014 11:18 am

Post by AshishDevassy »

alright.
Here's what you can try.
Read the data as varchar. Use transformer to extract the data before the ' ' and then use type conversion function to change it to date.
that's wierd ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Research format strings, in particular how to accommodate elements that have a variable number of characters (for example your month and day components may have one or two digits).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
taylor.hermann
Premium Member
Premium Member
Posts: 32
Joined: Wed Aug 20, 2014 11:17 am

Post by taylor.hermann »

I'd try researching the StringToTimestamp function available. It sounds like it may fit your needs
Post Reply