COUNT - Numeric overflow ocurred during computation

Database
SPB
N/A

COUNT - Numeric overflow ocurred during computation

Hi!. I have a question about the COUNT function.

In the Teradata DW I have huge tables and when I want to execute a COUNT over a BIGINT field I come across with the "Numeric overflow ocurred during computation". 

I have tried to define the fields as FLOAT in the table in order not to use a CAST() to FLOAT in the view.

Is there anyway to avoid using a CAST in the view of the table?. I want the view to be as clear as possible (as similar as the table).

Thanks!.

Sergio.- 

2 REPLIES
N/A

Re: COUNT - Numeric overflow ocurred during computation

Hi Sergio,

this is independant of the column's data type, by default COUNT returns an INTEGER in a Teradata mode session (in ANSI mode it's a DECIMAL with at least 15 digits).

You must use CAST(COUNT(*) AS BIGINT).

Btw, in TD15.10 there's a new dbscontrol flag to change the default to BIGINT or NUMBER.

SPB
N/A

Re: COUNT - Numeric overflow ocurred during computation

Danke schön Dieter!.

Sergio.-