0

I am trying to update a row in the MySQL table, the data of the column is -122.333351900 and it already exists, so there is no problem on its length not matching the data type and its length.

But when I run a UPDATE sql command it fails with

ERROR 1264 (22003): Out of range value for column 'longitude' at row 1

I don't understand why its wrong? It already has inserted this value and now when I run an UPDATE command it fails with an error!

Sana
  • 9,895
  • 15
  • 59
  • 87
  • Do you have a trigger on that table? – juergen d Dec 06 '17 at 01:08
  • @juergend you are my angel! Please put that as an answer and I can accept.... The trigger was having a wrong datatype and hence the issue. – Sana Dec 06 '17 at 01:11
  • 2
    For what it's worth, check out https://stackoverflow.com/questions/7167604/how-accurately-should-i-store-latitude-and-longitude Using precision of DECIMAL(13,9) is measuring longitude down to the tenths of millimeters! :-) – Bill Karwin Dec 06 '17 at 01:29
  • I can insert that value into a column of that type. There's got to be something else in play here. – tadman Dec 06 '17 at 01:52

1 Answers1

2

Check your table if it has a trigger on it. A trigger runs right before or after the update/insert on a table.

If it contains an error it looks like the update is going wrong when actually a related trigger fails.

juergen d
  • 201,996
  • 37
  • 293
  • 362
  • I had a trigger and the column in the archive table was having different DECIMAL definition – Sana Dec 07 '17 at 01:30