Numeric overflow issue

Database

Numeric overflow issue

Hi,

I am getting the below given error but the table from which i am selecting the value has datatype as decimal and the table which i am inserting also has datatype as decimal but while inserting it's giving the below error. I tried to convert it to numeric and varchar but still facing the same issue. I used TRIM function also so that if any space is there it will be trimmed but still facing the same issue.

       *** Failure 2616 Numeric overflow occurred during computation.

                      Statement# 1, Info =0

       *** Total elapsed time was 27 seconds.

4 REPLIES

Re: Numeric overflow issue

Check once again the precision. If you can share the source and its data type and the target and its datatype.

To avoid re-work, I am posting a reference of the past posts of our friends here. It may help you identify.

https://forums.teradata.com/forum/database/numeric-overflow-error-in-teredata

Re: Numeric overflow issue

Hi,

Source details as follows:

Col1 Decimal(5,0)

Col2 Decimal(5,0)

Target details as follows:

Col1 Decimal(9,0)

Col2 Decimal(9,0)

Col3 Decimal(3,0)

but one thing i noticed is few of the values comes as MINUS value but i tried to convert like this,

CAST(CAST(TRIM(Col1) AS DECIMAL) AS INTEGER)

Re: Numeric overflow issue

With col1 and col2 precisions , given , it works fine when  I do 

insert into target select col1,col2 from source;

Btw, casting decimal to integer, means losing precision. It may not be what business want.

Re: Numeric overflow issue

is Col3 populated by doing a substraction from col1 and col2? if so there might be a value in either col1 or Col2 which upon doing a minus gives a decimal which is greater than Decimal(3,0) and less than Decimal(5,0). Define Col3 as Decimal(5,0) and verify.