Claus Pedersen
Member³
I have the following piece of code:
It outputs 20 as expected.
I now refactor the variable deptno and rename it into my_deptno.
The first thing I notice is that four instances of deptno are highlighted including the table column name. This is also renamed so my resulting code now looks like:
Now the method has ceased to function correctly, it outputs NULL beause the variable is now selected into itself.
The refactoring must newer rename a table column. If PLD can not handle expressions like the above correctly, it is better off leaving them untouched, this way giving compile errors, and then it is up to the user to correct the code manually.
It was pure luck that our code looking like the one stated above was not put into production before we discovered the error.
The code compiles beautifully, so no one in the development team expected any problems.
This error can cause quite critical errors, so I suggest that is is corrected ASAP, preferably already in the existing version 7.1.4.
My current version is 7.1.4.1391
Code:
CREATE PROCEDURE test AS
deptno emp.deptno%TYPE;
BEGIN
SELECT deptno
INTO deptno
FROM emp
WHERE empno = 7369;
dbms_output.put_line (deptno);
END;
I now refactor the variable deptno and rename it into my_deptno.
The first thing I notice is that four instances of deptno are highlighted including the table column name. This is also renamed so my resulting code now looks like:
Code:
CREATE PROCEDURE test AS
my_deptno emp.deptno%TYPE;
BEGIN
SELECT my_deptno
INTO my_deptno
FROM emp
WHERE empno = 7369;
dbms_output.put_line (my_deptno);
END;
The refactoring must newer rename a table column. If PLD can not handle expressions like the above correctly, it is better off leaving them untouched, this way giving compile errors, and then it is up to the user to correct the code manually.
It was pure luck that our code looking like the one stated above was not put into production before we discovered the error.
The code compiles beautifully, so no one in the development team expected any problems.
This error can cause quite critical errors, so I suggest that is is corrected ASAP, preferably already in the existing version 7.1.4.
My current version is 7.1.4.1391