1

estoy creando este procedimiento almacenado por medio de un script, pero me da un error me podrian indicar cual es el error.

CREATE DEFINER=`newportaladmin`@`%` PROCEDURE `ExecutablesToBeDeleted`(
in productid int,
in platformid int,
in deviceid int
)
BEGIN
select e.idExecutable, e.bundleName, e.status from mybd.executables e
inner join mybd.products_has_executables pxe on e.idExecutable=pxe.executableIdExecutable
inner join mybd.devices_has_executables dxe on dxe.executableIdExecutable=e.idExecutable
where pxe.productIdProduct =productid AND e.platformIdPlatform=platformid AND e.status='distribution'
and dxe.deviceIdDevice=deviceid
and e.idExecutable not in
(select p.executableIdExecutable
from mybd.products_has_executables p
where p.productIdProduct!=productid);
END
5
  • 1
    y el error es?????
    – gbianchi
    el 2 may. 2022 a las 2:49
  • El error literal dice esto: 0 4 22:08:02 END Error Code: 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 'END' at line 1 0.000 sec el 2 may. 2022 a las 3:08
  • Creo que te falta poner los DELIMITER $$ antes del BEGIN luego en el END poner END $$ y luego DELIMITER ; @AndredGarciaMartin el 2 may. 2022 a las 9:40
  • 1
    Presta atención a lo que te dice @JavierG.Raya en su comentario. Para entender por qué debes usar DELIMITER y cómo usarlo correctamente, revisa este tutorial. Si el código sigue dando error, pulsa en editar para ver cómo ha quedado luego de poner DELIMITER.
    – A. Cedano
    el 2 may. 2022 a las 9:47
  • @A.Cedano creo ya se lo he solucionado pero no estoy seguro hasta que lo pruebe :) el 2 may. 2022 a las 11:51

1 respuesta 1

0

Es importante usar los delimiter correctamente.

La solución :

1. Poner DELIMITER $$ Antes del BEGIN.

2. Donde pones END cámbialo por END $$, el $$ se debe al DELIMITER $$.

3. Volver a cambiar el delimitador por defecto con DELIMITER ; debajo del END $$

CREATE DEFINER=`newportaladmin`@`%` PROCEDURE `ExecutablesToBeDeleted`(in productid int, in platformid int, in deviceid int)
DELIMITER $$
BEGIN
select e.idExecutable, e.bundleName, e.status from mybd.executables e
inner join mybd.products_has_executables pxe on e.idExecutable=pxe.executableIdExecutable
inner join mybd.devices_has_executables dxe on dxe.executableIdExecutable=e.idExecutable
where pxe.productIdProduct =productid AND e.platformIdPlatform=platformid AND e.status='distribution'
and dxe.deviceIdDevice=deviceid
and e.idExecutable not in
(select p.executableIdExecutable
from mybd.products_has_executables p
where p.productIdProduct!=productid);
END $$
DELIMITER ;

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.