当前位置:网站首页>MySQL function to get the full path
MySQL function to get the full path
2022-06-30 19:11:00 【Caozhenhua】
DROP FUNCTION IF EXISTS GetFullPath;
CREATE FUNCTION GetFullPath(InputDeptId char(36))
RETURNS VARCHAR(1000)
BEGIN
declare fullPath VARCHAR(1000) default '';
declare parentId char(36) default '';
declare num int default 0;
select concat(`Name`,'/',fullPath),UpperId into fullPath,parentId
from MDM_Dept
where DeptId=InputDeptId;
WHILE parentId<>'' DO
select count(1) into num from MDM_Dept where DeptId=parentId;
if num>0 then
select concat(`Name`,'/',fullPath),UpperId into fullPath,parentId
from MDM_Dept
where DeptId=parentId;
else
set parentId='';
end if;
END WHILE;
return fullPath;
END;
select GetFullPath(DeptId) fullPath,DeptId,UpperId,`Name` from MDM_Dept边栏推荐
猜你喜欢

Electron 入门

mysql for update 死锁问题排查

Adhering to the concept of 'home in China', 2022 BMW children's traffic safety training camp was launched

Infineon - GTM architecture -generic timer module

Leader: who can use redis expired monitoring to close orders and get out of here!

Coding officially entered Tencent conference application market!

拓维信息使用 Rainbond 的云原生落地实践

拓維信息使用 Rainbond 的雲原生落地實踐

AI首席架构师10-AICA-蓝翔 《飞桨框架设计与核心技术》

Small program container technology to promote the operation efficiency of the park
随机推荐
NBI可视化平台快速入门教程(五)编辑器功能操作介绍
一点比较有意思的模块
slice
What if the apple watch fails to power on? Apple watch can not boot solution!
联想YOGA 27 2022,超强配置全面升级
音频 librosa 库 与 torchaudio 库中 的 Mel- spectrogram 进行对比
Unlimited cloud "vision" innovation | the 2022 Alibaba cloud live summit was officially launched
一套十万级TPS的IM综合消息系统的架构实践与思考
CODING 正式入驻腾讯会议应用市场!
浏览器窗口切换激活事件 visibilitychange
torch stack() meshgrid()
【TiDB】TiCDC canal_json的实际应用
Four tips tell you how to use SMS to promote business sales?
Cloud Native Landing Practice Using rainbond for extension dimension information
PyTorch学习(三)
金融服务行业SaaS项目管理系统解决方案,助力企业挖掘更广阔的增长服务空间
Leader: who can use redis expired monitoring to close orders and get out of here!
Dlib library for face key point detection (openCV Implementation)
AI chief architect 10-aica-lanxiang, propeller frame design and core technology
Some interesting modules