1

我正在尝试创建一个过程,但它给了我语法错误。我不确定似乎是什么问题

        delimiter $$
        create
        procedure inactivity()
        LANGUAGE SQL
        begin
        [mysql block]
        end $$
        delimiter; 
4

2 回答 2

3

我自己想通了。问题是分隔符和分号之间没有空格。

于 2013-05-15T05:07:43.343 回答
2

试试这个 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 

$$

在分隔符输入字段中,我输入了这个值:$$

于 2013-05-14T18:03:14.507 回答