mysql - Mysql版本5.6.11中的存储过程

标签 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 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 8 行 '' 附近使用的正确语法

最佳答案

删除;

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$$

关于mysql - Mysql版本5.6.11中的存储过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22379443/

相关文章:

使用 phpMyAdmin 将表导入现有表

Mysql 在控制台/phpmyadmin : ERROR 1044 (42000): Access denied for user 'root' @'localhost' to database 'test123' 上显示错误

php - 当 mysql_num_rows 说有数据时,mysql_fetch_array 返回 false,为什么?

mysql - 这个查询输出什么?

mysql - MySql 中的存储过程性能

mysql - 如何从 sql 转储导入到 MongoDB?

mysql 长度限制

php - mysql根据用户左连接多个表

MySql 计算包含某个值的行组数量

php - 数据库未出现在 MYSQL 控制台中