I am trying to create a view in Oracle EBS database from different tables, and the view has few columns that are calculated type particularly there are two columns in which the base tables are off combination of varchar type and number type and the resulting view has the type as Number type for this two columns I have tried to avoid errors while data conversion from type two number type by using
TO_NUMBER(revenue, DEFAULT 0 ON CONVERSION ERROR)
And if this view is queried, I’m getting the results in oracle as expected, but when trying to query from DVS like Denodo I am seeing an error that there is a non-numeric type in place where a numeric type is expected for these two row. if I remove these two columns, I am able to get the results perfectly on the Denodo side but when I include these two columns, I am getting the same error. I’ve tried various options, but no luck, but when the view is converted as a table on the Oracle side, and queried from DENODO it is working fine. I don’t understand where the issue is.
The calculated columns in the view are :
DECODE (
SIGN (expenditure_item_date - TO_DATE ('20-JUN-2010')),
1, DECODE (
attribute7,
NULL, DECODE (trans_source,
'Payroll', quantity,
'Eff_Report', quantity,
'Shops', quantity,
0),
TO_NUMBER (attribute7 DEFAULT 0 ON CONVERSION ERROR)),
NVL (quantity, 0))
and
DECODE (
SIGN (expenditure_item_date - TO_DATE ('20-JUN-2010')),
1, NVL (quantity, 0),
DECODE (
attribute7,
NULL, DECODE (trans_source,
'Payroll', quantity,
'Eff_Report, quantity,
'Shops', quantity,
0),
TO_NUMBER(attribute7 DEFAULT 0 ON CONVERSION ERROR)))
FYI attribute7 is of varchar type and quantity is of Number type.
When the view is queried from Denodo, I am getting
[JDBC ROUTE] [ERROR] Received exception with message 'ORA-01858: a non-numeric character was found where a numeric was expected'
That error is not coming from the
TO_NUMBER()calls, it's coming from theTO_DATE()calls.The ORA-01858 error is described as:
So the issue is the date format model, which you have not provided, so it's using an implicit format model, not the number conversion part.
Doing
TO_DATE ('20-JUN-2010')relies on your sessions' NLS settings, and those are different in the two clients/applications where you are testing this. That applies to the date format model, causing this error, and (as you are using a month abbreviation) the date language.You could do a more explicit conversion:
but with a fixed value it would be simpler to use a date literal:
fiddle