Difference in select for update of ... in Oracle Database 10g and 11g
- by sax
Hi,
I found out that Oracle Database 10g and 11g treat the following PL/SQL block differently (I am using scott schema for convenience):
DECLARE
v_ename bonus.ename%TYPE;
BEGIN
SELECT b.ename
INTO v_ename
FROM bonus b
JOIN emp e ON b.ename = e.ename
JOIN dept d ON d.deptno = e.deptno
WHERE b.ename = 'Scott'
FOR UPDATE OF b.ename;
END;
/
While in 10g (10.2) this code ends successfully (well NO_DATA_FOUND exception is raised but that is expected), in 11g (11.2) it raises exception "column ambiguously defined". And that is definitely not expected. It seems like it does not take into account table alias because I found out that when I change the column in FOR UPDATE OF e.empno (also does not work) to e.mgr (which is unique) it starts working. So is this some error in 11g? Any thoughts?