本文内容来自YashanDB官网,原文内容请见 https://www.yashandb.com/newsinfo/7802941.html?templateId=1718516
【关键字】update (子查询) set ORG_ID_STAN =ID 改写
【问题描述】
update (子查询) set ORG_ID_STAN =ID 改写
【问题原因分析】
update (子查询) set ORG_ID_STAN =ID 改写,崖山展示不支持子查询的直接修改
后续可以在内核版本中支持
【解决/规避方法】
修改前
UPDATE ADMIN_AUTH_ORG T1 SET T1.ORG_ID_STAN =
(SELECT T2.ID FROM STAN_ORG_DEPT_INFO T2
WHERE T2.TYPE_ID = 'ORG'
AND (T1.ORG_ID = T2.ID AND T1.ORG_NAME = T2.NAME_SHORT))
WHERE T1.ORG_ID_STAN IS NULL;
修改后
UPDATE ADMIN_AUTH_ORG T1
SET T1.ORG_ID_STAN =
(SELECT T2.ID
FROM STAN_ORG_DEPT_INFO T2
WHERE T2.TYPE_ID = 'ORG'
AND (T1.ORG_ID = T2.ID AND T1.ORG_NAME = T2.NAME_SHORT))
WHERE T1.ORG_ID_STAN IS NULL
AND EXISTS (SELECT 1
FROM STAN_ORG_DEPT_INFO T2
WHERE T2.TYPE_ID = 'ORG'
AND (T1.ORG_ID = T2.ID AND T1.ORG_NAME = T2.NAME_SHORT));
【影响范围】YashanDB 22.2.3.1
【修复版本】-