I'm guessing that "upper(b.ADDRESS) = lower(b.ADDRESS)" is a test to see if the column is numeric. Except it's not a very good one.