ORACLE小问题但很急,希望高手来帮解决一下
UPDATE T1_PSN_HR
SET UNIT_XT=(SELECT DISTINCT B.ID FROM T1_PSN_HR A,T2_ORG_TRAN B
WHERE A.Org_Code_L2=B.HR_ORG_ID)
报的错误是UNIT_XT无效标识符,
我现在的情况是t1_psn_hr里边有这个 unit_xt字段且是varchar2型
而select 语名查出来的B.ID是varchar2型的
为什么update不进去,,谢谢做答
[解决办法]
UPDATE T1_PSN_HR A SET UNIT_XT = (SELECT MAX(B.ID) FROM T2_ORG_TRAN B WHERE A.ORG_CODE_L2 = B.HR_ORG_ID) WHERE EXISTS (SELECT 1 FROM T2_ORG_TRAN B WHERE A.ORG_CODE_L2 = B.HR_ORG_ID);