运行结果及报错内容
这是oracle的递归函数,从子部门递归父级部门
CREATE OR REPLACE FUNCTION FUN_GET_ORG_ID (child_dept_id IN NUMBER
return NUMBER
is
retCode number:=-1;
BEGIN
SELECT
distinct dept_Id INTO retCode
FROM
t_Department_Info
WHERE
par_dept_id is null
start with dept_Id = child_dept_id
connect by prior par_dept_id = dept_Id;
RETURN (retCode) ;
END ;
我的解答思路和尝试过的方法
我查了一下mysql递归,完全看不懂,链接如下
https://blog.csdn.net/wocaizhale/article/details/121600221
我想要达到的结果
请问有会sql的帮我改一下他这段吗