当前位置:Gxlcms > 数据库问题 > Oracle 递归拼接字段

Oracle 递归拼接字段

时间:2021-07-01 10:21:17 帮助过:24人阅读

LISTAGG(T.NAME, / ) WITHIN GROUP(ORDER BY LEVEL DESC) AS RESULT FROM S_WORK_RESOURSE T START WITH T.WORK_RESOURCE_NO = 323 CONNECT BY PRIOR T.PARENT_WORK_RESOURCE_NO = T.WORK_RESOURCE_NO and T.PARENT_WORK_RESOURCE_NO is not null

后台应用

                string GetLevelName_2 = @"SELECT LISTAGG(T.AREA_NAME, ‘ / ‘) WITHIN GROUP(ORDER BY LEVEL DESC) AS RESULT
  FROM PRODUCE_EQUIPMENT_AREA T
 START WITH T.ID = {0}
CONNECT BY PRIOR T.PARENT = T.ID
       and T.PARENT is not null";
                foreach (DataRow dr in v.Dt.Rows)
                {
                    if (StringUtil.isNotNullOrBlank(dr["EI_CLS"]))
                    {
                        dt = DbUtil.QueryDT(string.Format(GetLevelName_1, dr["EI_CLS"]));
                        if (dt != null)
                        {
                            dr.BeginEdit();
                            dr["EI_CLS2"] = dt.Rows[0]["RESULT"].ToString();
                            dr.EndEdit();
                        }
                    }
                }

 

Oracle 递归拼接字段

标签:orb   span   row   beginedit   name   format   level   class   orm   

人气教程排行