Edit: I have found the root of the problem, and
reported it below. I have opened a Service Request 7045745.993 on the problem.
Original text:
I have encountered the most bizarre bug today. An associate is trying to debug a 1900 line package that was NOT terminating a loop properly.
The package has the code:
Exit when x <> y;
where x and y are VARCHAR2(8) variables.
The problem is that even though the values were UNequal, the loop never ended. We added dbms_output debugging code to display x and y, and we could easily see that their values were NOT equal.
For instance, one was 19824E1A and the other was 19824E2A. Or one was 19824E1A while the other was 99999999.
I even added a block of code re-testing the condition like this:
If x <> y then
dbms_output.put_line(x||'<>'||y);
Else
dbms_output.put_line(x||'='||y);
End if;
But no matter what the values of x and y, it always reported them equal.
I found two workarounds:
1. concatenate a character (I used a period) to the end of each variable in the condition.
Exit when x||'.' <> y||'.'
2. Or, add an anonymous block before or after the Exit when..., such as:
Declare
v varchar2(2);
Begin
v := 'AB';
End;
Curiously, when I replaced the v := 'AB'; with NULL;, the bug came back.
This bug occurs on Oracle Database 10g Enterprise Edition Release 10.2.0.3.0
I am not sure where to start to try to solve or report this problem. It pretty much destabilizes the entire PL/SQL programming foundation for all our packages. It leaves me wondering where else the code may be failing.
Has anyone seen something like this reported before?
Edited by: Steve Cosner on Aug 27, 2008 10:05 PM