String to Timestamp Conversion

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
sankawa
Participant
Posts: 11
Joined: Thu Sep 13, 2007 12:55 am

String to Timestamp Conversion

Post by sankawa »

Hi,

I am using CSV file as Source and Oracle as Target.Now i want to convert string to timestamp.The source data format is dd/mm/yyyy and the required format is yyyy-mm-dd hh:nn:ss.when i tried it showing the following Message:
Conversion error calling conversion routine timestamp_from_string data may have been lost
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: String to Timestamp Conversion

Post by gateleys »

sankawa wrote:Hi,

I am using CSV file as Source and Oracle as Target.Now i want to convert string to timestamp.The source data format is dd/mm/yyyy and the required format is yyyy-mm-dd hh:nn:ss.when i tried it showing the following Message:
Conversion error calling conversion routine timestamp_from_string data may have been lost

Code: Select all

Oconv(Iconv(InputDate, "D/DMY[2,2,4]"), "D-YMD[4,2,2]")
During the write step, the time portion will be taken care of.
gateleys
sankawa
Participant
Posts: 11
Joined: Thu Sep 13, 2007 12:55 am

Post by sankawa »

Hi
Thks for replying.but i am using parallel job Transformation and Unix operating system.Plz solve my Query.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Plz post your complete Derivation.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sankawa
Participant
Posts: 11
Joined: Thu Sep 13, 2007 12:55 am

Post by sankawa »

Thanks for your speedy reply .
Actually My input is a CSV file am reading in Sequential stage ... and Transition_dt is one of the input column in dd/mm/yyyy and Iam passign this value through Transformer and my Traget is Oracle where datatype of same field is Timestamp ....
So i need to convert my input String into time stamp ..
I tried Stringtotimetamp convertion available in PX transformer but Am getting error like lost Data :-(


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

Post by chulett »

chulett wrote:Plz post your complete Derivation.
Since you didn't do that, I'll ask again. And now that other details are leaking out, clarify something. Your Oracle target field is a Timestamp in the job but what is it in the target table - DATE? TIMESTAMP? Plus - what stage are you using for the Oracle piece of this?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mhasan
Participant
Posts: 38
Joined: Wed Apr 19, 2006 10:03 pm
Location: Bangalore

Post by Mhasan »

Chulett ,
I reply from the behave of sandeep .. as we both had same issue ....
what is it in the target table - DATE? TIMESTAMP
Answer :-- Timestamp
what stage are you using for the Oracle piece of this?
Answer :-- Oracle stage in PX
Thanks
M A hasan
sankawa
Participant
Posts: 11
Joined: Thu Sep 13, 2007 12:55 am

Post by sankawa »

hulett,
This is the information required by you...
what is it in the target table - DATE? TIMESTAMP
Answer :-- Timestamp
what stage are you using for the Oracle piece of this?
Answer :-- Oracle stage in PX

and the other thing the job is successfully run with some warning. but it doesn't updating the target table and show the warning-- conversion may cause Data Lost...

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

Post by chulett »

Not quite there. :?

what is it in the target table - DATE? TIMESTAMP?
Answer :-- TIMESTAMP.
Question :-- to what level of precision?

what stage are you using for the Oracle piece of this?
Answer :-- Oracle stage.
Question :-- which Oracle stage?

Last but not least, perhaps third time will be the charm: Please post your complete derivation as a starting point.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sankawa
Participant
Posts: 11
Joined: Thu Sep 13, 2007 12:55 am

Post by sankawa »

hi

Question:-- to what level of precision?
Ans:--Without Precision
Source format is dd/mm/yyyy(String) and target format is Timestamp it doesn't matter the format in target but it should be Timestamp value...
Question :-- which Oracle stage?
Ans:--Oracle Enterprice

This is the complete vale i specified in the transformation.
Column Name SQL-Type Length Scale Nullable Description
VALUDATION_DT Timestamp - - Yes Nullable TimeStamp

I tried in two way:---
First way is-------
I create one staging variable mydate(String) and use the rite the Query:--
SrcCorpriceSf.VALUATION_DT[7,4] : "-" : SrcCorpriceSf.VALUATION_DT[4,2] : "-" : SrcCorpriceSf.VALUATION_DT[1,2] : " 00:00:00"
and after that in VALUDATION_DT feild i wrote the following Querry:--
StringToTimestamp(mydate,"%yyyy-%mm-%dd %hh:%nn:%ss")

Second way is-----
I wrote the querry directly to VALUDATION_DT feild:--
StringToTimestamp(SrcCorpriceSf.VALUATION_DT[7,4] : "-" : SrcCorpriceSf.VALUATION_DT[4,2] : "-" : SrcCorpriceSf.VALUATION_DT[1,2],"%yyyy-%mm-%dd %hh:%nn:%ss")
But data is not loadinfg to thr target Table...

Sorry i can't give you more information abt this issue,actually i am new to Data Stage,plz try to understand my problem and solve it.
Post Reply