Home > database >  MYsql database loading into a custom function of dream function spelled trouble help to see how to c
MYsql database loading into a custom function of dream function spelled trouble help to see how to c

Time:01-22

The CREATE DEFINER=` biaozw1 ` @ % ` ` FUNCTION ` getParentList ` (rootId VARCHAR (10)) RETURNS a VARCHAR (1000) CHARSET utf8
The BEGIN
DECLARE
Fid VARCHAR (10) the DEFAULT ';
DECLARE
STR VARCHAR (1000) the DEFAULT rootId;
WHILE rootId IS NOT NULL DO
The SET of fid=(
SELECT
Parent_id
The FROM
Main_classification
WHERE
Main_classification_id=rootId
);
IF fid IS NOT NULL THEN
SET the STR=concat (STR, '-', fid);
The SET rootId=fid;
The ELSE
The SET rootId=fid;
END IF;
END the WHILE;
RETURN the CONCAT (' - ', STR, '-');
END

This is a query of the root node function will finally get the node connected with - database using a dream how to write for help
  • Related