Hallo zusammen,
ich habe folgen Fehler beim erstellen einer Funktion, hoff das ihr mir weiter helfen könnt.
FEHLER:
MySQL Fehlernummer 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 cariable)
SQL FUNCTION:
Mit freundlichen Grüßen
ProLeg
ich habe folgen Fehler beim erstellen einer Funktion, hoff das ihr mir weiter helfen könnt.
FEHLER:
MySQL Fehlernummer 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 cariable)
SQL FUNCTION:
Code:
CREATE FUNCTION `cms_dobotech`.`addCategorie` (name VARCHAR(45), parent INT, sortno INT, keywords VARCHAR(225), description VARCHAR(250)) RETURNS INT
BEGIN
/*Define the varibales for the method*/
DECLARE levelno INT;
DECLARE urlname VARCHAR(90);
DECLARE id INT;
/*Get the level of the new Categorie an set the parent on NULL if no parent needed*/
IF parent = 0 THEN
SET parent = NULL, levelno = 0;
ELSE
SELECT cate_level+1 FROM cms_categorie WHERE cate_id = parent INTO levelno;
END IF;
/*Check if a categorie with the same Level and Parent already exsist, an exit with a error code if it is true*/
SELECT cate_id FROM cms_categorie WHERE (cate_name LIKE name) && (cate_level = levelno) && (cate_parent = parent) LIMIT 1 INTO @checkname;
IF @checkname <> NULL THEN
RETURN -404;
END IF;
/*Get the new sort number or make the given sortnumber free*/
IF sortno = 0 THEN
SELECT MAX(cate_sortno) FROM cms_categorie WHERE (cate_level = levelno) && (cate_parent = parent) INTO sortno;
ELSE
UPDATE cms_categorie SET cate_sortno = cate_sortno+1 WHERE (cate_sortno <= sortno) && (cate_level = levelno) && (cate_parent = parent);
END IF;
/*Parse the name to an url conform name for the links*/
SET urlname = LOWER(REPLACE(name,' ','_'));
SET urlname = REPLACE(urlname,'ü','ue');
SET urlname = REPLACE(urlname,'ä','ae');
SET urlname = REPLACE(urlname,'ö','oe');
SET urlname = REPLACE(urlname,'ß','ss');
/*Insert the new categorie with the generatet and given infos*/
INSERT INTO cms_categorie (cate_name, cate_urlname, cate_sortno, cate_level, cate_parent, cate_keywords, cate_description)
VALUES (name,urlname,sortno,levelno,parent,keywords,description);
/*Get the id of the new categorie as result*/
SELECT LAST_INSERT_ID() INTO id;
RETURN id;
END
Mit freundlichen Grüßen
ProLeg