创建存储过程时报错: 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 'row_count() into insert_count; IF (insert_count = 0) THEN ROLLBACK; set r_result' at line 10 有人遇到过吗?怎么解决的
-------------------------分割线-------------------------
问题已解决 select 写成了 selcet 晕死。。。o(╯□╰)o
问题找到了。。。。select 写成了 selcet。。。。o(╯□╰)o
DELIMITER $$ CREATE PROCEDURE `seckill`.`execute_seckill` (in v_seckill_id bigint, in v_phone bigint, in v_kill_time timestamp, out r_result int) BEGIN DECLARE insert_count int DEFAULT 0; START TRANSACTION; insert ignore into success_killed (seckill_id, user_phone, create_time) values (v_seckill_id, v_phone, v_kill_time); selcet row_count() into insert_count; IF (insert_count = 0) THEN ROLLBACK; set r_result = -1; ELSEIF(insert_count < 0) THEN ROLLBACK; set r_result = -2; ELSE update seckill set number = number - 1 where seckill_id = v_seckill_id and end_time > v_kill_time and start_time < v_kill_time and number > 0; selcet row_count() into insert_count; IF (insert_count = 0) THEN ROLLBACK; set r_result = 0; ELSEIF (insert_count < 0) THEN ROLLBACK; set r_result = -2; ELSE COMMIT; set r_result = 1; END IF; END IF; END; $$
这是照着老师写的存储过程代码