cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Bonjour,

   I am trying a simple math calcul that my tabletop cheap calculator can easily handle but Sybase just can't ....


declare @totalsize float

select @totalsize=(894720*4096/1048576)

Arithmetic overflow occurred ... Sybase errorcode 3606

No matter what type I use (numerci, bigint, int, nameit), nothing is working, my database is simple unable to handle this calcul.

Anyone has an idea what's going on!?

0 Likes
View Entire Topic
Former Member
0 Likes

Like *all* DBMS's, ASE attempts to translate literals into datatypes - e.g. you couldn't even begin the above in Java without specifying types.    ASE attempts based on the value - and for most numeric values without a decimal, it treats as an 'int' unless >2B.    So in your case you have:

int * int /int

....but the int*int overflows int.

Simple fix

select @totalsize=(894720.0*4096/1048576)


Now, because of the .0, ASE treats the first value as a float - and following standard ANSI rules float * int = float ... /int = float...