Enter your keyword


Oracle Integration | format-dateTime() is failing with “The XPath expression failed to execute

While doing the conversion of current date time into another format using the format:dateTime() function into Oracle Integration:

xp20:format-dateTime(fn:current-dateTime(),"[Y0001]-[M01]-[D01] [H01]:[m01]:[s01]")

you may face the following error:

Error Summary: XPath expression failed to execute.
An error occurs while processing the XPath expression; the expression is xp20:format-dateTime(fn:current-dateTime(),"[Y0001]-[M01]-[D01] [H01]:[m01]:[s01]").
The XPath expression failed to execute; the reason was: oracle.fabric.common.xml.xpath.XPathFunctionException: Xpath20Function

Issue: The issue is the xp20:format-dateTime expects a dateTime as String however current-dateTime function returns a xs:dateTime.

Solution: First convert the current-dateTime into the string and then use the format-dateTime function. Following is the correct statement to convert the current-dateTime:

xp20:format-dateTime(string(fn:current-dateTime()),"[Y0001]-[M01]-[D01] [H01]:[m01]:[s01]")

After implementing the solution, you will be able to convert the current date time into the required format.

Request you to subscribe to my YouTube channel for regular updates.

Further readings:

OSS-005: Unable to test the connection: OCI Streaming

BASE64Decoder: Error in encoded stream: Oracle Integration

Integrating Oracle Integration with API GW

Merge two different schema files into a single CSV file in Oracle Integration

Leave a Reply

Your email address will not be published.