Bonjour à tous,

J'ai une requête qui calcule la distance entre deux points en insérant une longitude et une latitude, elle me ressort toutes les personnes qui sont à X kilomètres.

Mais j'ai cette erreur

Integer overflow. The result of an integer operation caused the most significant bit of the result to carry.
Voici donc la requête, je ne sais pas trop comment m'y prendre pour régler ce problème...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
WITH MESCOORDONNEES AS ( 
  SELECT COS(3.14159265358979*".$longitude."/180) as LNG_COS, SIN(3.14159265358979*".$longitude."/180) as LNG_SIN, COS(3.14159265358979*".$latitude."/180) as LAT_COS, SIN(3.14159265358979*".$latitude."/180) as LAT_SIN 
  FROM table
)                                 
SELECT (6371*ACOS(LAT_COS*COS(3.14159265358979*C_LATITUDE/180)*LNG_COS*COS(3.14159265358979*C_LONGITUDE/180)+LAT_COS*LNG_SIN*COS(3.14159265358979*C_LATITUDE/180)*SIN(3.14159265358979*C_LONGITUDE/180)+LAT_SIN*SIN(3.14159265358979*C_LATITUDE/180))) as DISTANCE, (c.C_FAMILLECONTACT||ascii_char(10)||ascii_char(13)||c.C_NOM) as C_NOM, c.* 
FROM CONTACTFICHE c, MESCOORDONNEES 
WHERE (C_LATITUDE is not null AND C_LATITUDE <> 0) 
AND (C_LONGITUDE is not null AND C_LONGITUDE <> 0)
AND (6371*ACOS(LAT_COS*COS(3.14159265358979*C_LATITUDE/180)*LNG_COS*COS(3.14159265358979*C_LONGITUDE/180)+LAT_COS*LNG_SIN*COS(3.14159265358979*C_LATITUDE/180)*SIN(3.14159265358979*C_LONGITUDE/180)+LAT_SIN*SIN(3.14159265358979*C_LATITUDE/180))) <= 20
Merci à toute aide qui pourrait être apporté !