Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ORA-01861: literal does not match format string

54 views
Skip to first unread message

sathee...@gmail.com

unread,
Sep 15, 2021, 1:56:15 AM9/15/21
to
Hi Team,

In IGI we are getting the start date/end date as below,
stardate : 2021-09-14 00:00:00
end date : 2021-12-31 23:59:59
while updating to the oracle DB it is failing with the below error,
"$$$ ERROR MESSAGE $$$java.sql.SQLDataException: ORA-01861: literal does not match the format string."

in the target, end start and end date are defined as a date type.

Now how to convert this string to date type in the AL code. So please help me with this issue.

Regards,
Satheesh G


Eddie Hartman

unread,
Sep 16, 2021, 3:01:35 AM9/16/21
to
If the values you have are string values, try converting them to java.util.Date using system.parseDate() - look in the TDI/SDI Javadocs under the UserFunctions class.

Once you have a java.util.Date then you can create Attribute values of type java.sql.Date like this:

work.startdate = new java.sql.Date(system.parseDate(startdateString, "yyyy-MM.dd' 'HH:mm:ss").getTime());

If the startdate and enddate values are already date times, you can skip the parseDate() bit.

/Eddie

sathee...@gmail.com

unread,
Sep 16, 2021, 4:20:29 AM9/16/21
to
Thanks, Eddie. Can you please explain some more on try converting them to java.util.Date using system.parseDate() code .
If the startdate and enddate values are already date times: Yes I'm getting both the values. possible can you give heads-up on the overall code that will help me understand more.
Regards,
Satheesh G

0 new messages