Date Conversion Error - ORA-01861: literal format matching

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
bgs_vb
Premium Member
Premium Member
Posts: 79
Joined: Mon Jan 02, 2006 5:51 am

Date Conversion Error - ORA-01861: literal format matching

Post by bgs_vb »

Hi OnlineGurus,

my routine is like this:

MaxVal = "1753-01-01 00:00:00"

Temp1 = LEFT(MaxVal,10)
Temp2 = RIGHT(MaxVal,8)

MaxDate = OCONV(Temp1, "D/YMD[4,2,2]")
MaxTime = OCONV(Temp2, "MTS")
Ans = MaxDate:" ":MaxTime

I am getting the literal error. my doubt is whether we can use both date and time withing a single string and what format does oracle use. how to check the format.

Thanks in advance

Regards,
Vindy
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Vindy,

The OCONV() functions you have will convert an internal representation to an external one, so before you can convert your raw strings to the appropriate format you will need to convert them to internal format. Assuming you don't need any data error correction you can use:

Code: Select all

Temp1 = ICONV(LEFT(MaxVal,10),'D4-YMD')
Temp2 = ICONV(RIGHT(MaxVal,8),'MTS')
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Actually, if you are using an OCI stage and a datatype of Timestamp - you've already got it in the proper format. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
bgs_vb
Premium Member
Premium Member
Posts: 79
Joined: Mon Jan 02, 2006 5:51 am

Post by bgs_vb »

Hi Craig,

here i am using ODBC stage, not OCI stage.

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

Post by chulett »

Yuck, whatever for. Still, I think you'll find using a Timestamp type and your current format will work - even in ODBC.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kwwilliams
Participant
Posts: 437
Joined: Fri Oct 21, 2005 10:00 pm

Post by kwwilliams »

Craig,

you are correct timestamp is the correct format even using ODBC.
Post Reply