MySQL存储过程没有参数

时间:2013-05-14 17:42:42

标签: mysql stored-procedures

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

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

2 个答案:

答案 0 :(得分:3)

我自己想通了。错误的是分隔符和分号之间没有空格。

答案 1 :(得分: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;

------------------------------ UPDATE ---------------- --------------------

我在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 

$$

在Delimiter输入字段中,我输入了这个值:$$