我正在尝试创建一个过程,但它给了我语法错误。我不确定似乎是什么问题
delimiter $$
create
procedure inactivity()
LANGUAGE SQL
begin
[mysql block]
end $$
delimiter;
我正在尝试创建一个过程,但它给了我语法错误。我不确定似乎是什么问题
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;
- - - - - - - - - - - - - - - 更新 - - - - - - - - - - -----------------
我在 phpmyadmin 中运行它并且它有效:
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
$$
在分隔符输入字段中,我输入了这个值:$$