Page 1 of 1

String to timestamp conversation

Posted: Wed Oct 17, 2012 6:11 am
by Sagnik Mukherjee
Hi,

In transformer stage i use String to Timestamp function like this :

StringToTimestamp(lnk_CONV.TS4,"%yyyy-%mm-%dd-%hh.%nn.%ss.%SSSSSS")

the data is coming to transformer either with this format or with 'space'.
Data in TS4 is proper.We are handling the 'space' also.
Though this transformation job is aborted showing this fatal error :


[APT_CombinedOperatorController,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%yyyy-%mm-%dd-%hh.%nn.%ss.%SSSSSS" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid format [%yyyy-%mm-%dd-%hh.%nn.%ss.%SSSSSS] used for string_from_time type conversion.]

Please advice.

Posted: Wed Oct 17, 2012 6:33 am
by chulett
As the error notes, your format is invalid. From the docs:

For a timestamp, the format is %yyyy-%mm-%dd %hh:%nn:%ss. If extended to include microseconds, the format is %yyyy-%mm-%dd %hh:%nn:%ss.x, where x gives the number of decimal places seconds is given to.

Posted: Wed Oct 17, 2012 6:59 am
by Sagnik Mukherjee
Actually we are getting with that format only from source file and as its a multi instance job, I cant see the possibility to change the format in stagevar also.
What 2 do now.

Posted: Wed Oct 17, 2012 7:26 am
by chulett
Fix your format in the transformer StringToTimestamp() function call. Nothing else to do for that particular issue.

Posted: Wed Oct 17, 2012 2:39 pm
by oracledba
StringToTimestamp(lnk_CONV.TS4,"%yyyy-%mm-%dd-%hh.%nn.%ss.%SSSSSS")



simply only include this

StringToTimestamp(lnk_CONV.TS4)

the extra fitting is causing the error.

Posted: Wed Oct 17, 2012 3:51 pm
by chulett
oracledba wrote:simply only include this

StringToTimestamp(lnk_CONV.TS4)

the extra fitting is causing the error.
Sorry but that's just not correct and will generate syntax errors as well.

Posted: Thu Oct 18, 2012 12:11 am
by Sagnik Mukherjee
The problem has been solved. In that microsecond part instead of giving .%SSSSSS, i gave .%6. Means now I have given like this :

StringToTimestamp(lnk_CONV.TS4,"%yyyy-%mm-%dd-%hh.%nn.%ss.%6")

and the job succesfully ran.I didnot know about this format of timestamp.