I am using one IF
inside a stored procedure :
CREATE PROCEDURE SP_Registro_Crear (IN paramero1 VARCHAR(50), IN Parametro2 INT)
BEGIN
IF (1 = 0) THEN
END IF;
END;
But I get the following error:
consulta SQL:
CREATE PROCEDURE SP_Registro_Crear (IN paramero1 VARCHAR(50), IN Parametro2 INT)
BEGIN
IF (1 = 0) THEN
END IF
MySQL ha dicho: Documentación
#1064 - Algo está equivocado en su sintax cerca 'END IF' en la linea 5
Beyond that you are creating a stored procedure, I invite you to read the doc. MySQL official regarding 1
IF STATMENT
Which expects a syntax of this form ( extracted from the referenced doc ):
So if you analyze the code that you present, your code lacks the segment called: statment_list , to indicate what actions would be carried out if the established condition is met.
Example
As you can see in this example, I am creating a stored procedure that once it receives a numerical value, it evaluates if it is greater than 10 and if it is true, then it obtains all the records of a table X whose id is equal to the value received as an argument.
So during your PA declaration you shouldn't be skipping writing the logic that will be executed if the conditional is true.
References
IF