Mysql 5.6.11版中的存储过程

时间:2014-03-13 13:00:35

标签: mysql phpmyadmin

我正在尝试使用Mysql 5.6.11版创建存储过程,但它显示一些错误, 这是我的代码。

 CREATE PROCEDURE Debug(Message TEXT)
    BEGIN
    CREATE TABLE IF NOT EXISTS _debug (
        id int(10) unsigned NOT NULL auto_increment,
        msg TEXT DEFAULT NULL,
        created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
        PRIMARY KEY (id)
     );
 INSERT INTO _debug(`msg`) VALUES(Message);
 END; 

我收到此错误:

#1064 - 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 '' at line 8

1 个答案:

答案 0 :(得分:0)

删除;

delmiter $$
CREATE PROCEDURE Debug(Message TEXT)
    BEGIN
    CREATE TABLE IF NOT EXISTS _debug (
        id int(10) unsigned NOT NULL auto_increment,
        msg TEXT DEFAULT NULL,
        created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
        PRIMARY KEY (id))
 INSERT INTO _debug(`msg`) VALUES(Message)
 END$$