29 lines
523 B
SQL
29 lines
523 B
SQL
DELIMITER $$
|
|
CREATE OR REPLACE DEFINER=`root`@`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 ;
|