-1
我正在嘗試創建下面的mysql程序,但是我被困在最後兩個小時了,我不知道它有什麼問題。Mysql程序錯誤,
delimiter $$
drop procedure if exists pos_finder;
create procedure pos_finder()
begin
declare below, normal, normal_h, svalue, eid, above int default 0;
declare bcounter, ncounter, acounter int default 0;
declare done int default 0;
declare userData cursor for select e.id, s.value, t.below_normal_h,
t.Normal_b, t.Normal_h, t.above_normal_l from k_employee as e, k_trackers_data as s, k_trackers_sub as t where e.id = 3 and s.user_id = e.id and t.id = s.sub_tracker_id;
declare continue handler for not found set done = 1;
open userData;
fetch userData into eid, svalue, below, normal, normal_h, above;
if svalue < below then
set bcounter = bcounter + 1;
else if svalue > normal then
set ncounter = ncounter + 1;
else if svalue > above then
set acounter = acounter + 1;
end if;
close userData;
end$$
Mysql的說
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '' at
line 19
這是接近用戶數據線。我在這裏和那裏移動換行符總是給這條線上的錯誤
請有人可以告訴我,我在做什麼錯了?
你救了我的一天:)我幾乎放棄了MySQL,並開始在PHP中的邏輯工作..謝謝噸:) :) – Kamal