[SOLVED] SAP to Oracle Date - java.lang.String cannot be cast to java.util.Date -

Hello Everyone.

I created a flow service that receives data from a SAP notification and this data must be inserted in an Oracle table.

This table contains a column that is using the DATE data type.

But, I didn’t figure out how can I insert the SAP date format ‘yyyy-mm-dd’ into this oracle table. It always gives me the following error:

Error: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date

I tried the pub.date:dateTimeFormat to format the date as “dd/MMM/yy” but it gives me the same issue.

Please, what should I do to be able to insert the SAP Date format (yyyy-mm-dd as String) into an oracle table (as java.util.Date in my adapter service).

Thank you

Hi Renan,

Did you try by changing the Input Field Type as - java.lang.String from the drop-down in the adapter service?

That way you should be able to pass the string input formatted whatever date format you want and pass it on to the adapter service.

Regards,
Firoz N

4 Likes

Hello @Firoz

I managed to solve the issue.

I followed your suggestion, but it didn’t work in the first time.

But, I added TO_DATE(?, ‘yyyy-mm-dd’) in the expression of the DATE column and it worked!

Thank you Firoz

4 Likes