Conversion from varchar data type to date with timestamp

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
nilesh
Participant
Posts: 17
Joined: Tue Aug 08, 2006 5:02 am
Location: Mumbai

Conversion from varchar data type to date with timestamp

Post by nilesh »

Hi,

I am using CSV file as my input stage with date data type defined as varchar2(20) . The format is date with timestamp.My target data type is date. I also want to preserve its timestamp. My target database is oracle10g.

Can anybody help me out how do i make conversion from varchar to date in transformer.

Thanks in advance
Nilesh
Nilesh Malekar
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

StringToTimestamp(). and then DateFromTimestamp().
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

As there are no data types within DataStage (Server Edition), if your source date is in valid timestamp format, you can load it straight in to a column whose data type is TimeStamp. If your source data character string is not in valid format, then use substring and concatenation to get it into a valid format.
Maveric wrote:StringToTimestamp(). and then DateFromTimestamp().
If this is a server job, I think above functions won't work.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Those functions won't work in Server, as already stated. If your string date format is the same as the default date format of your Oracle instance then you don't need any conversion at all. What stage are you using to write to Oracle?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In what format is the date/time in the CSV file? If it is correct for your Oracle settings, then (as others have observed) you need to do nothing. Otherwise you can re-arrange the string components with substring and concatenation operators.
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