Page 1 of 1

Error message: ORA-01858: a non-numeric character was found

Posted: Thu Sep 06, 2018 3:55 am
by satheesh_color
Hi All,

When i try to execute the below query in sql developer/Toad it's fecthing the required results.

DATE1 & DATE2 is date datatype in oracle

SELECT
nvl(abs(to_date(DATE2,'dd/mm/yyyy') - to_date(DATE1,'dd/mm/yyyy')),0) as DATEDIFF,
FROM TABLE;

But, when i try the same in Oracle Connector in Datastage it throws me the below error message.



Error code: 1858, Error message: ORA-01858: a non-numeric character was found where a numeric was expected.

Kindly let me know your thoughts on the same.

Thanks.

Posted: Thu Sep 06, 2018 7:01 am
by chulett
How is your target column DATEDIFF defined in the job?

Posted: Thu Sep 06, 2018 7:03 am
by satheesh_color
Hi,

It has been defined as decimal(38,8) in Dataset.






Thanks.

Posted: Thu Sep 06, 2018 7:13 am
by chulett
Just in case it is different, I actually meant in the Connector... same?

Posted: Thu Sep 06, 2018 8:36 am
by satheesh_color
Hi,

Thanks Craig. Now i have changed the datatype as varchar(96) and the issue gets resolved.






Thanks.

Posted: Thu Sep 06, 2018 9:00 am
by chulett
Sure, that's one way to "fix" the issue. All that shows is that you did indeed have "non-numeric" data in your output somewhere. Keep in mind all it takes is one record to cause that and it's not necessarily something you'll see in Toad. You'll see it there if the issue happens within a join but the output data is not typed in Toad whereas it is in DataStage and that's why you can see it in one tool when the problem is only in what you've selected but not the other.

Re: Error message: ORA-01858: a non-numeric character was fo

Posted: Mon Sep 24, 2018 11:14 pm
by rrcr
satheesh_color wrote:Hi All,

When i try to execute the below query in sql developer/Toad it's fecthing the required results.

DATE1 & DATE2 is date datatype in oracle

SELECT
nvl(abs(to_date(DATE2,'dd/mm/yyyy') - to_date(DATE1,'dd/mm/yyyy')),0) as DATEDIFF,
FROM TABLE;

But, when i try the same in Oracle Connector in Datastage it throws me the below error message.



Error code: 1858, Error message: ORA-01858: a non-numeric character was found where a numeric was expected.

Kindly let me know your thoughts on the same.

Thanks.


When date1 and date2 are already date data types, i dont understand why are you trying to convert to date again?
You can simply write abs(date1-date2).