0
我缺乏經驗,構建存儲過程也碰到了這個錯誤,我不明白背後的原因:存儲過程:數據截斷:截斷不正確DOUBLE值
[2015年9月29日1時01分55秒] [22001] [1292]數據截斷:截斷不正確DOUBLE值: '5609d3e6c89be'
值 '5609d3e6c89be' 是 「FLIGHTID」。
我的存儲過程的代碼:
DROP PROCEDURE IF EXISTS initFlight;
CREATE PROCEDURE initFlight (flightid VARCHAR(50))
BEGIN
-- rules, player should only fly if not in jail, not in missions
-- and is in the city the flight will take off from
DECLARE fname VARCHAR(50); -- flight name
DECLARE depart int; -- city number of departure
DECLARE dest int; -- city number of destination
-- assign values to our variables
select flightname, source_airport, destination_airport
into fname, depart, dest
from airport_flights where id = flightID;
-- show in console the variable values for debugging
-- select concat(" fname: ", fname, " depart: ", depart, " dest: ", dest);
-- set players flying means p.live = '-1'
update `[players]` as p set p.live = '-1' where p.id in (
select id from airport_tickets where flight = flightID
) and p.live = depart;
-- insert into alerts a message for players boarding the flight (are in the city of departure)
insert into player_alerts (alert_text, player_id)
select concat("Boarding flight ", fname) as alert_text, p.id as player_id from `[players]` as p
where p.id in (
select id from airport_tickets where flight = flightID
) and p.live = depart;
-- insert into alerts a message for players that missed the flight (are not in the city of departure)
insert into player_alerts (alert_text, player_id)
select concat("You missed flight ", fname) as alert_text, id as player_id from `[players]` as p
where p.id in (
select id from airport_tickets where flight = flightID
) and p.live != depart;
-- stop sales
update airport_flights set selling_tickets = 0 where id = flightID;
END;
call initFlight('5609d3da016bf');
這到底是怎麼回事?爲什麼我的「字符串」被轉換爲雙精度,然後被截斷?
airport_flights.id is varchar(50)
airport_flights.source_airport is int(11)
airport_flights.destination_airport is int(11)
airport_tickets.id is varchar(50)
airport_tickets.flight is varchar(50)
airport_tickets.owner_id is int(11)
`[players]`.id is int(11)
`[players]`.live is int(11)
`[players]`.name is varchar(200)
player_alerts.id is int(11)
player_alerts.alert_text is varchar(250)
PS:如果你需要更多的信息,讓我知道和批評是一如既往歡迎
如果你把球員表也放在一起,這將有所幫助。 – e4c5
從http://stackoverflow.com/questions/26743197/err-1292-truncated-incorrect-double-value:**這是真正蹩腳的錯誤之一,可能與實際問題沒有任何關係。**是否知道該過程中的哪個查詢出錯? – Barmar
現在添加播放器字段。至於錯誤的查詢,我不知道,這些查詢是由1,然後結合到存儲過程,有沒有辦法來調試呢? –