Error in SP MYSQL

0

I have the following error:

  

#1064 - Algo está equivocado en su sintax cerca '' en la linea 6

I show code

CREATE PROCEDURE spF_detalleVenta_one1(cod int)
BEGIN
SELECT d.CodigoVenta, d.CodigoProducto, p.Nombre, d.Cantidad, d.Descuento 
FROM detalleventa d 
inner join producto p on p.CodigoProducto = d.CodigoProducto
WHERE d.CodigoVenta = cod;
END;

Any idea why he does not run?

    
asked by Fabian Feriks 31.05.2018 в 02:21
source

1 answer

1

The problem that is occurring is that you have an error in the syntax at the time of creating the stored you have to put the delimiter , so your code would be as follows:

DELIMITER //
CREATE PROCEDURE spF_detalleVenta_one1(cod int)
BEGIN
SELECT d.CodigoVenta, d.CodigoProducto, p.Nombre, d.Cantidad, d.Descuento 
FROM detalleventa d 
inner join producto p on p.CodigoProducto = d.CodigoProducto
WHERE d.CodigoVenta = cod;
END //

More information official documentation from MySQL.

    
answered by 31.05.2018 / 02:37
source