我試圖創建一個過程,但它給了我語法錯誤。我不能肯定什麼似乎是問題MySQL存儲過程不帶參數
delimiter $$
create
procedure inactivity()
LANGUAGE SQL
begin
[mysql block]
end $$
delimiter;
我試圖創建一個過程,但它給了我語法錯誤。我不能肯定什麼似乎是問題MySQL存儲過程不帶參數
delimiter $$
create
procedure inactivity()
LANGUAGE SQL
begin
[mysql block]
end $$
delimiter;
我想通了我自己。有什麼問題是分隔符和分號之間沒有空格。
試試這個SQL代碼:
delimiter $$
drop procedure if exists question_inactivity;
create procedure question_inactivity()
begin
delete from questions_temp where active= 1;
update questions set active = 0 where question_id in(select question_id from questions_temp);
drop table questions_temp;
end $$
delimiter;
-------------------- ---------- UPDATE ------------------------------------
我在phpMyAdmin和it'works運行以下命令:
delimiter $$
create procedure question_inactivity()
begin
delete from questions_temp where active= 1;
update questions set active = 0 where question_id in(select question_id from questions_temp);
drop table questions_temp;
end
$$
在分隔符輸入字段我把這個值:$$
什麼是錯誤消息和線?它與? – w5m 2013-05-14 18:02:03
@ w5m,這是錯誤:#1064 - 你的SQL語法有錯誤;檢查對應於你的MySQL服務器版本使用附近的正確語法手冊「CREATE PROCEDURE question_inactivity() 開始 從questions_temp其中刪除」在第2行 – Wabbit 2013-05-14 18:05:40
提示:寫正確每個SQL語句,與'端線;'哪裏需要在[mysql block]裏面 – diEcho 2013-05-15 05:12:31