qq_36128558
qq_36128558
采纳率8.7%
2017-10-13 07:54 浏览 1.0k

mysql自定义函数查询会报错 应该是死循环吧

BEGIN
DECLARE sTemp text;
DECLARE sTempChd text;
SET@@group_concat_max_len = 102400;
SET sTemp = '$';
SET sTempChd = rootId;
WHILE sTempChd IS NOT NULL DO
SET sTemp = concat(sTemp, ',', sTempChd);
SELECT
group_concat(comcode) INTO sTempChd
FROM
PrpDcompany
WHERE

FIND_IN_SET(UPPERCOMCODE, sTempChd) > 0;
END WHILE;
SET@@group_concat_max_len = 1024;
RETURN SUBSTRING(sTemp,3);
END
这是函数

    这是sql
    select * from PrpDcompany 
where FIND_IN_SET(COMCODE, Dcompany(1044)); 

    这是错误
    [SQL]select * from PrpDcompany 
where FIND_IN_SET(COMCODE, Dcompany(1044));

[Err] 1406 - Data too long for column 'sTemp' at row 53

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答 默认 最新

  • looktan520 looktan520 2017-10-13 08:32

    sTemp 数据长度太长了

    点赞 评论 复制链接分享

相关推荐