oci can't handle miliseconds

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
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

oci can't handle miliseconds

Post by randy »

Hi,

I am getting the following error when I try to load a timestamp with miliseconds:

ORA-01830: date format picture ends before converting entire input string

I manipulate the date to look like this: yyyymmdd hh24:mi:ss.MMM

I am using OCI9 and have the field defined as timestamp.

Thanks for any suggestions
Randy
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

I tried doing that and got the same error message. Then I trimmed off the milliseconds as it was not of importance to the user. Before you want to do anything, I would suggest you to findout if milliseconds data is really important for the client or would it be ok if you skipped it.

If you want to trim the milliseconds then use the Field function in the Transformer Derivation. Hope that helps.

Kris
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

Post by randy »

Thanks, but the miliseconds if very important to the project.
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Will changing the default NLS_DATE_PARAMETERS in Oracle help? Try it.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

Post by randy »

I guess I could, but was really hoping to do it in datastage.
Isn't there someway of doing this?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

what is the length and the scale of the timestamp field you have specified in the OCI stage :?:
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

Post by randy »

The length is 26
The scale is 6
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: oci can't handle miliseconds

Post by gateleys »

Did you try setting the scale to 3?

gateleys
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

Post by randy »

The same:

xfmLoad: ORA-01830: date format picture ends before converting entire input string
randy
Participant
Posts: 30
Joined: Tue Sep 13, 2005 11:17 am

Post by randy »

got it.
user defined sql

INSERT INTO tbl
(D_TRANSACTION_DATE_TIME)
VALUES
(TO_TIMESTAMP(:1, 'YYYY-MM-DD HH24:MI:SS.FF'))

not real elegant, but it works.

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

Post by ray.wurlod »

Yay! Does the FF part of the timestamp picture handle any fractional seconds (say microseconds) or is it limited to milliseconds?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

randy wrote:not real elegant, but it works.
Yes, that's what you have to do. The OCI stage doesn't natively support the Oracle TIMESTAMP datatype, only DATE, so you need to wrap it up yourself with an appropriate 'TO_TIMESTAMP' function call that matches the way the TIMESTAMP was declared in the target table.

You may also be able to get away with treating it as a Varchar and making sure your data is in the correct format but to me the TO_TIMESTAMP is more 'appropriate' in spite of the custom sql that is (by necessity right now) involved.

Ray, the FF part is not limited to milliseconds but to the fractional precision declared when the TIMESTAMP was created - and the fractional seconds precision can range from 0 to 9 digits, from what I recall.
-craig

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