Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE DEFINER=`TBH997`@`%` PROCEDURE `AgregarPuntos`( puntos INT, _nombre varchar(20), _historial varchar(100))
- BEGIN
- DECLARE idUsu INT;
- IF (exists(select nombre from prueba where nombre=_nombre))
- THEN
- update prueba set monedas = monedas + puntos where nombre=_nombre;
- select idUsuario into idUsu from prueba where nombre=_nombre;
- insert into historial (idUsuario,log,visible, fecha) values(idUsu, _historial, 1,now());
- select monedas from prueba where nombre=_nombre;
- else
- insert into prueba (nombre,monedas) values (_nombre, puntos);
- select idUsuario into idUsu from prueba where nombre=_nombre;
- insert into historial (idUsuario,log,visible, fecha) values(idUsu, _historial, 1,now());
- select monedas from prueba where nombre=_nombre;
- END IF;
- END
Advertisement
Add Comment
Please, Sign In to add comment