Olá, gostaria de saber onde estou errando, eu transcrevi o código escrito pelo prof deu o Undeclared variavel e se eu tentar copiar e colar o código, do Consolidando conhecimento que há algumas diferenças em relação ao código da aula também ocorre erro.
========================
Com código contido na aula , seguinte erro:
Operation failed: There was an error while applying the SQL script to the database.
Executing:
USE sucos_vendas
;
DROP function IF EXISTS f_numero_aleatorio
;
DELIMITER $$
USE sucos_vendas
$$
CREATE FUNCTION f_numero_aleatorio
(min int, max int)
RETURNS INTEGER BEGIN declare vRetorno int; SELECT floor(( RAND()* (max-min + 1)) + min) into vreturno; return vretorno; END$$
DELIMITER ;
ERROR 1327: Undeclared variable: vreturno
SQL Statement:
CREATE FUNCTION f_numero_aleatorio
(min int, max int)
RETURNS INTEGER BEGIN declare vRetorno int; SELECT floor(( RAND()* (max-min + 1)) + min) into vreturno; return vretorno; END
========================
Com código contido no Consolidando conhecimento, seguinte erro:
Executing: USE sucos_vendas;
DROP function IF EXISTS f_numero_aleatorio;
DELIMITER $$
USE sucos_vendas$$
CREATE FUNCTION f_numero_aleatorio(min INT, max INT) RETURNS int(11)
BEGIN
DECLARE vRetorno INT;
SELECT FLOOR((RAND() * (max-min+1)) + min) INTO vRetorno;
RETURN vRetorno;
END$$
DELIMITER ;
Operation failed: There was an error while applying the SQL script to the database. ERROR 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable) SQL Statement: CREATE FUNCTION f_numero_aleatorio(min INT, max INT) RETURNS int(11)
BEGIN
DECLARE vRetorno INT;
SELECT FLOOR((RAND() * (max-min+1)) + min) INTO vRetorno;
RETURN vRetorno;
END