Timestamp to Numeric value

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
neeraj
Participant
Posts: 107
Joined: Tue May 24, 2005 4:09 am

Timestamp to Numeric value

Post by neeraj »

HI,

I have a requirement like... I want to convert my timestamp i.e. 2010-09-09 22:01:01 to a numeric field which I can use in my range look up.

I had found some functions in oracle and DataStage to convert date into numeric field but I could not find anything for Timestamp.

Is there any function available to do that...

Regards
Neeraj
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What kind of 'numeric' value would you convert your sample timestamp to? 20100909220101? Something else?
-craig

"You can never have too many knives" -- Logan Nine Fingers
neeraj
Participant
Posts: 107
Joined: Tue May 24, 2005 4:09 am

Post by neeraj »

Hi,

I need to range lookup.

As commincated by my colleage, range lookup doesn't work on string . it works for numeric field and for unknown reasons, a date or timestamp field is considered as string.

So you need to transform your date or timestamps in a numeric field to get the correct results.

So I am getting start_dt_tm and end_dt_tm from my source which is a dataset and chg_dt_tm from my reference link which is coming from Database. I need to check chg_dt_tm between start_dt_tm and end_dt_tm.

The one solution which I have to add 2 tranformer before doing a lookup and split my record i.e. chg_dt_tm , start_dt_tm and end_dt_tm, in to date and time first and then use the functions JulianDayFromDate and SecondsFromTime and concatenate and store into integer and use it for lookup.

Please suggest.

Regards
Neeraj
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or you could just convert all the non-numeric characters to "" then store in a BigInt and proceed. Hence Craig's question about what format of number were you looking to use.
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