Conversion error

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
Ratan Babu N
Participant
Posts: 34
Joined: Tue Dec 27, 2005 12:13 am

Conversion error

Post by Ratan Babu N »

Hi,
In my Job, while I am converting from string (of length 10) to date and string (of length 10) to timestamp.
I gave the condition as -- If it is not a valid date then '0001-01-01' for date and '0001-01-01 00:00:00.000000' for timestamp. But eventhough the input record has a valid date it is giving the default values only in the output.

and the warning i got in the director is as follows

Trns_Validate,0: Conversion error calling conversion routine date_from_string data may have been lost

Plz help me out in this issue.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Ratan

Look the format of the string in the source and check whether you are using the same format to check whether it is valid or not?. How are verifying whether the string is valid date or not?... Give some examples and your conversion logic we might be able to help you

Thanks
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
Ratan Babu N
Participant
Posts: 34
Joined: Tue Dec 27, 2005 12:13 am

Post by Ratan Babu N »

Hi Siva,
Thank you very much, I gave a different format thats why i didnot get initially.
one more query is : the input field is a string '12-23-2005' can we convert it into timestamp directly. I tried with stringtotimestamp function.but i got the message as

Trns_Validate,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%mm-%dd-%yyyy" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid Format [%mm-%dd-%yyyy] used for string_from_time type conversion.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Ratan
the input field is a string '12-23-2005' can we convert it into timestamp directly

Your string only has date part and not time part. What you need to do is concat date and time part together and then convert it into timestamp. If you don't have time part then have default values

Thanks
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You can use TimestampFromDateTime(). You can give the datea as one input and hardcoded default time as other.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply