Datetime Issue based on Different Platforms

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
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Datetime Issue based on Different Platforms

Post by Andal »

One of my source column is Timestamp and target column is Date when inserting data into target it giving errror " The string representation of a datetime value is out of range SQLSTATE =22007" . I tried many option like Substrings,ToDate and %DateOut function but still it is not solving the problem. I am getting this error in DB2 OS390, But i am not getting this error in Oracle and Db2Unix.

If i change the date field as Varchar(10), it is working in OS390 and DB2 but failing in Oracle. Is there any way to achieve this.
Rgds
Anand
gradkarthik
Participant
Posts: 28
Joined: Fri Jul 29, 2005 3:51 pm
Location: Arizona, USA

Post by gradkarthik »

Hi,
you need to convert the timestamp format to the date format using ICONV and OCONV function before you can load them in to either DB2Unix. I am not sure what the format is for OS390 but what ever it is, the conversion has to be done in a transformer stage before loading.
Look in the BASIC Manual for the explanations of ICONV and OCONV. There are also lots of posts on this site which give you an idea. Search using iconv, oconv as keywords.
gradkarthik
Andal
Participant
Posts: 124
Joined: Thu Dec 02, 2004 6:24 am
Location: Bangalore, India

Post by Andal »

Thanks Karthik, But I had already tried using OCONV. Is it necessary to change the date to Datastage and Internal format and then again changing for Database format.

Anyhow , today i will try using the combinations of Iconv and Oconv.
Rgds
Anand
vijay.swarup
Participant
Posts: 7
Joined: Tue Nov 22, 2005 5:46 am
Contact:

Post by vijay.swarup »

hi,
here i can suggest a small solution to your issue...

you try to use " DateTimeStampToInfCLI(<input timestamp>) "
this function converts timestamp to date.
this function is available in DSRoutines/SDK. there are many similar functions of different drivers compatible you can try for apt one...


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

Post by chulett »

It sounds like to me that you are trying to come up with some sort of 'universal solution' - some technique to handle Timestamps across all 'platforms' as you call it in exactly the same manner. Can't be done.

Oracle has different requirements than DB2. Other databases throw in other wrinkles. Requirements can also change based on the stage you are using. Best, in my opinion, to standardise on a format for date / time handling like the ISO standard. Basically:

YYYY-MM-DD HH24:MI:SS

Time is optional and can include milliseconds for databases that can handle them, like SQL Server. Then build a set of routines that all developers can leverage to take dates / timestamps and prep them for each database - one for Oracle, one for DB2, etc.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply