Execute Query activity is failing to run the given query and throwing Arithmetic operation resulted in an overflow
Issue Description
Workflow Failure Due to Unsupported Data Type:
When executing a SQL query on a table column with the NLCOB data type, you may encounter the following error in UiPath:
"Arithmetic operation resulted in an overflow"
Root Cause
This error typically occurs because the NLCOB data type (used in databases like SAP HANA or other SQL-based systems) is not natively supported by UiPath's Database activities. UiPath may fail to interpret or process this data type correctly, leading to workflow crashes.
Resolution
To resolve this issue, you need to explicitly convert the NLCOB column to a supported string format, such as NCHAR, within your SQL query. This can be done using the TO_NCHAR() function, which safely transforms the NLCOB data into a readable format for UiPath.
The TO_NCHAR function in SAP HANA SQL is a conversion function used to convert a TEXT expression, date, or number into the NTEXT data type, often in a specified format. This function is primarily utilized for formatting output data.
Syntax:
TO_NCHAR( string-expression [, source-charset-name ] )
Example Queries
Example 1
Suppose your table is named CustomerData and the problematic column is CustomerNotes (of type NLCOB). You can modify your query like this:
SELECT TO_NCHAR(CustomerNotes) AS CustomerNotes, CustomerID, CustomerName
FROM CustomerData;
This query converts the CustomerNotes column to NCHAR, allowing UiPath to process it without errors.
Example 2
SELECT TO_NCHAR(CURRENT_DATE, 'YYYY-MM-DD') AS FormattedDate FROM DUMMY;
NTEXT string formatted as 'YYYY-MM-DD'.TO_NCHAR exists for conversion, SAP HANA generally recommends using VARCHAR/NVARCHAR instead of CHAR/NCHAR for column definitions, as the latter are not fully supported and have different blank padding semantics. However, TO_NCHAR remains a valid function for converting data types for output or specific processing needs.