MySql教程

oracle数据库转mysql-04

本文主要是介绍oracle数据库转mysql-04,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

select *from t_com_dept_info;
select *from t_com_dept_info where find_in_set(dept_id, getChildLst_DEPT('DEP33603856-a4df-48e2-8eef-ef255ba80417'));

 

CREATE DEFINER=`gk`@`%` FUNCTION `getChildLst_Org`(
`rootId` VARCHAR(4000)
) RETURNS varchar(4000) CHARSET utf8mb4
BEGIN

DECLARE sTemp VARCHAR(4000);
DECLARE sTempChd VARCHAR(4000);

SET sTempChd = '';
if rootId is null or rootId = '' then set sTempChd = '-';
else set sTempChd = rootId;
end if;

SET sTemp = '';
SET sTemp = concat(sTemp,',',sTempChd);
WHILE sTempChd is not null DO

SET sTemp = concat(sTemp,',',sTempChd);
SELECT GROUP_CONCAT(t.organ_id) INTO sTempChd FROM t_com_organ_info t where FIND_IN_SET(nvl(t.parent_id,'-'),sTempChd)>0;

END WHILE;

RETURN sTemp;

END

这篇关于oracle数据库转mysql-04的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!