MySQL Forums
Forum List  »  Spanish

Alguien me podria decir que error tiene este procedimiento almacenado?
Posted by: marlon Laguna
Date: November 01, 2016 10:49AM

Saludos a todos desde ayer me estoy quebrando la cabeza... mi procediiento almacenado lo que hace es verificar si el usuario ya existe, en caso de que exista imprime el codigo de error 01 y mata al procedimiento almacenado pero por alguna extraña razon me da el siguiente error: '#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 'IF' at line 6

y aqui el procedimiento:

CREATE PROCEDURE insertar_usuarios(in usuarioo varchar(100),in numero_identidad varchar(100),in nombres varchar(100),in apellidos varchar(100), in correo varchar(100),in fecha_nacimiento date,in telefono varchar(100),in sexo varchar(2),in id_rol int,in pass varchar(100))

BEGIN
IF EXISTS(SELECT * FROM usuarios WHERE `usuario` = usuarioo ) THEN
SELECT '01'
KILL insertar_usuarios
END IF;

INSERT INTO `usuarios` (`usuario`,`numero_identidad`,`nombres`,`apellidos`,`correo`,`fecha_nacimiento`,`telefono`,`sexo`,`id_rol`,`Password`) VALUES(usuario,numero_identidad,nombres,apellidos,correo,fecha_nacimiento,telefono,sexo,id_rol,pass);
END

Options: ReplyQuote


Subject
Views
Written By
Posted
Alguien me podria decir que error tiene este procedimiento almacenado?
948
November 01, 2016 10:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.