Mysql import. SQL file problems

Source: Internet
Author: User
After editing a. SQL file and adding the following code (part of the code) to the text, an error will be reported when importing the SQL file (the newly added code cannot be imported). why? There is also how to solve this problem. Thank you! & Quot; ## Function & quot; fun_getChildList & quot; # DROPFUNCTIONIFEXISTS 'fun _ getchildlist'; CREATEFUNCTION 'fun _ getchildlist' ('type' int, 'areaid 'Int, 'orgid' int) R mysql

After editing a. SQL file and adding the following code (some code) to the text, an error will be reported when importing the SQL file (the newly added code cannot be imported)
Why? There is also how to solve this problem. Thank you!

 ## Function "fun_getChildList"#DROP FUNCTION IF EXISTS `fun_getChildList`;CREATE FUNCTION `fun_getChildList`(`type` int,`areaid` int,`orgid` int) RETURNS varchar(1000) CHARSET utf8BEGIN    DECLARE sTemp VARCHAR(1000);    DECLARE xh VARCHAR(50);    DECLARE areacode VARCHAR(100);    DECLARE cunt INT;    SELECT CONCAT(ORGXH,'%') INTO xh from ss_organization where ID_ORG=orgid;    IF type=1 THEN        set sTemp='$';        SELECT CONCAT(sTemp,',',GROUP_CONCAT(ID_ORG)) INTO sTemp from ss_organization where ORGXH like xh;    ELSEIF type=0 THEN        SELECT COUNT(1) into cunt FROM ss_organization where ss_organization.ID_ORG=orgid and ss_organization.ORG_DISTRPARENTID=areaid;        if cunt>0 then        select area_code INTO areacode from bs_distrarea_info where area_id=areaid;        SELECT IFNULL(GROUP_CONCAT(ID_ORG),'0') into sTemp from ss_organization         LEFT JOIN  bs_distrarea_info ON ORG_DISTRPARENTID=area_id where area_code like CONCAT(areacode,'%') and area_id<>areaid;        SELECT CONCAT(sTemp,',',IFNULL(GROUP_CONCAT(ID_ORG),'0')) INTO sTemp from ss_organization where ORGXH like xh;        ELSEIF cunt=0 THEN        SELECT IFNULL(GROUP_CONCAT(ID_ORG),'0') into sTemp from ss_organization where ss_organization.ORG_DISTRPARENTID=areaid;        end IF;        SET sTemp=CONCAT('$',',',sTemp);    END IF;    RETURN sTemp;END;## Function "fun_getOrgLine"#DROP FUNCTION IF EXISTS `fun_getOrgLine`;CREATE FUNCTION `fun_getOrgLine`(`orgid` int) RETURNS varchar(1000) CHARSET utf8BEGIN    DECLARE sTemp VARCHAR(1000);    DECLARE sTempChd VARCHAR(1000);    DECLARE grade INT;    DECLARE enterprisename VARCHAR(100);    DECLARE st INT;    SELECT ss_organization.ORG_GRADE,ss_organization.ENTERPRISE_NAME into grade,enterprisename from ss_organization where ss_organization.ID_ORG=orgid;    SET st=1;     WHILE grade<=st DO        set st=st+1;     END WHILE;    RETURN grade;END;## Function "getChildLst"#DROP FUNCTION IF EXISTS `getChildLst`;CREATE FUNCTION `getChildLst`(rootId INT) RETURNS varchar(1000) CHARSET utf8BEGIN     DECLARE sTemp VARCHAR(1000);       DECLARE sTempChd VARCHAR(1000);       SET sTemp = '$';       SET sTempChd =cast(rootId as CHAR);       WHILE sTempChd is not null DO         SET sTemp = concat(sTemp,',',sTempChd);         SELECT group_concat(o.ID_ORG) INTO sTempChd FROM ss_organization o where FIND_IN_SET(o.ORG_PARENT_ID,sTempChd)>0;       END WHILE;    RETURN sTemp;END;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.