Wednesday, April 20, 2011

Oracle Bug

One of my developers just noticed a strange behavior in all versions of Oracle 10g that we could test ( on Win32, on Win64).

Here is a simplified case:
REPLACE command is fired against a CLOB variable where we are trying to change 'T_' to 'ZZ'. In the CLOB there is a part of text that looks like 'T('.

To my own surprise, Oracle replaces both 'T_' and 'T(' with 'ZZ': it looks like underscore is being interpreted as a wild-card! By the way, this behavior is completely gone in 11gR2.

Code sample:
    v1_cl CLOB := 'T_T(a number)';
    v1_cl := replace (v1_cl, 'T_', 'ZZ');

Received result: ZZZZa number)
Expected result: ZZT(a number)

Update (thanks to Grigoriy Novikov): It is not a feature - it is a real Oracle bug (Metalink Bug ID:4598943), first detected in and fixed in 11g. So, please, be aware of it!

1 comment:

Grigoriy said...

Finally I found it on Metalink - Bug 4598943
Database Version -
Fixed in Product Version-
Workaround: None