2

次の手順でエラーが発生します

DELIMITER // 

DROP PROCEDURE IF EXISTS getDestaque //

CREATE PROCEDURE getDestaque(
OUT v_id_imovel_1 INT,
OUT v_titulo_1 VARCHAR(200),
OUT v_cidade_1 VARCHAR(120),
OUT v_categoria_1 VARCHAR(100),
OUT v_foto_1 VARCHAR(100),
OUT v_id_imovel_2 INT,
OUT v_titulo_2 VARCHAR(200),
OUT v_cidade_2 VARCHAR(120),
OUT v_categoria_2 VARCHAR(100),
OUT v_foto_2 VARCHAR(100)
)
BEGIN

    SELECT I.id_imovel INTO v_id_imovel_1, 
    I.titulo INTO v_titulo_1, 
    C.cidade INTO v_cidade_1, 
    CAT.categoria INTO v_categoria_1, 
    IFT.foto INTO v_foto_1
    FROM imoveis AS I
    INNER JOIN cidades AS C ON I.id_cidade = C.id_cidade
    INNER JOIN categorias AS CAT ON I.id_categoria = CAT.id_categoria
    INNER JOIN imoveis_fotos AS IFT ON I.id_imovel = IFT.id_imovel AND IFT.principal = 1
    WHERE I.destaque_index = 1
    ORDER BY RAND() LIMIT 1;

    SELECT I.id_imovel INTO v_id_imovel_2, 
    I.titulo INTO v_titulo_2, 
    C.cidade INTO v_cidade_2, 
    CAT.categoria INTO v_categoria_2, 
    IFT.foto INTO v_foto_2
    FROM imoveis AS I
    INNER JOIN cidades AS C ON I.id_cidade = C.id_cidade
    INNER JOIN categorias AS CAT ON I.id_categoria = CAT.id_categoria
    INNER JOIN imoveis_fotos AS IFT ON I.id_imovel = IFT.id_imovel AND IFT.principal = 1
    WHERE I.destaque_index = 1 AND I.id_imovel <> v_id_imovel_1 
    ORDER BY RAND() LIMIT 1;

    UPDATE imoveis SET destaque_index_view = destaque_index_view+1 WHERE id_imovel = v_id_imovel_1 OR id_imovel = v_id_imovel_2;

END
//

DELIMITER ;

動作せず、PhpMyAdmin でエラーが表示されません。誰か助けてもらえますか?

4

1 に答える 1