29 lines
521 B
SQL
29 lines
521 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`clientGetMana`(vClient INT)
|
|
RETURNS decimal(10,2)
|
|
DETERMINISTIC
|
|
BEGIN
|
|
/**
|
|
* Devuelve el mana del cliente.
|
|
*
|
|
* @param vClient Id del cliente
|
|
* @return Mana del cliente
|
|
*/
|
|
DECLARE vMana DECIMAL(10,2);
|
|
|
|
CREATE OR REPLACE TEMPORARY TABLE tmp.client
|
|
SELECT vClient id;
|
|
|
|
CALL client_getMana();
|
|
|
|
SET vMana = (SELECT mana
|
|
FROM tmp.clientMana);
|
|
|
|
DROP TEMPORARY TABLE
|
|
tmp.client,
|
|
tmp.clientMana;
|
|
|
|
RETURN IFNULL(vMana,0);
|
|
END$$
|
|
DELIMITER ;
|