24 lines
411 B
MySQL
24 lines
411 B
MySQL
|
DELIMITER $$
|
||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `srt`.`buffer_getRandom`()
|
||
|
RETURNS int(11)
|
||
|
NOT DETERMINISTIC
|
||
|
READS SQL DATA
|
||
|
BEGIN
|
||
|
|
||
|
/* Devuelve de forma aleatoria, uno de entre los buffers que tienen flejadora
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
DECLARE vBufferFk INT;
|
||
|
|
||
|
SELECT b.id INTO vBufferFk
|
||
|
FROM srt.buffer b
|
||
|
WHERE b.hasStrapper
|
||
|
ORDER BY RAND()
|
||
|
LIMIT 1;
|
||
|
|
||
|
RETURN vBufferFk;
|
||
|
|
||
|
END$$
|
||
|
DELIMITER ;
|