gpt4 book ai didi

mysql - 在 MySQL/MariaDB 中创建存储过程时出错

转载 作者:行者123 更新时间:2023-12-02 03:46:09 26 4
gpt4 key购买 nike

我尝试在 MySQL 中创建存储过程,但不断收到错误

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DELIMITER' at line 1

Expected delimiter. (near "" at position 10)

我做错了什么?编辑:消除错误后,现在我的程序只是插入空值,知道为什么吗?

DELIMITER //
CREATE PROCEDURE sp_TEXT4()


BEGIN
DECLARE refstock VARCHAR(20);
DECLARE frkmarca INT ;
DECLARE frkallextras INT ;
DECLARE frkeconservacao INT ;
DECLARE frkallcategorias INT ;
DECLARE modelo VARCHAR(45);
DECLARE titulo VARCHAR(45);
DECLARE ano INT;
DECLARE mes INT;
DECLARE horas INT;

DECLARE obs TEXT;
DECLARE preco DOUBLE;
DECLARE minpreco DOUBLE;
DECLARE negociavel BINARY(1);
DECLARE youtube VARCHAR(45);

SET refstock="refstock";
SET frkmarca=1;
SET frkallextras=1;
SET frkeconservacao=1;
SET frkallcategorias=1;
SET modelo ="modelo";
SET titulo="titulo";
SET ano=1;
SET mes=1;
SET horas=1;

SET obs="obs";
SET preco="1";
SET minpreco="1";
SET negociavel=true;
SET youtube="youtube";



INSERT INTO anuncios (refstock,frkmarca,frkallextras,frkeconservacao,frkallcategorias,modelo,titulo,ano,mes,horas,obs,preco,minpreco,negociavel,youtube)
VALUES (@refstock,@frkmarca,@frkallextras,@frkeconservacao,@frkallcategorias,@modelo,@titulo,@ano,@mes,@horas,@obs,@preco,@minpreco,@negociavel,@youtube);




END;
//
DELIMITER;

最佳答案

DELIMITER 和分隔符之间需要空格:

DELIMITER ;

关于mysql - 在 MySQL/MariaDB 中创建存储过程时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46693598/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com