Saturday, September 03, 2005

If at first you don't succeed

Just came across this in a rather large query I have to fix:
NVL(di_core.di_tools.area_code_translate(v_switch_id,d.dncode),
    di_core.di_tools.area_code_translate(v_switch_id,d.dncode))

3 comments:

OraWTFGuy said...

That's crazy. It should obviously be:-

COALESCE (
di_core.di_tools.area_code_translate(v_switch_id,d.dncode),
di_core.di_tools.area_code_translate(v_switch_id,d.dncode),
di_core.di_tools.area_code_translate(v_switch_id,d.dncode)
)

...because there's no guarantee the second one will be non-null ;o)

Tony Andrews said...

Is there a route for submitting examples for your consideration?

I have a rather fine 985-line SQL Loader control file I'd like to tell you about...

Adrian said...

Maybe

di_core.di_tools.area_code_translate(v_switch_id,d.dncode)

returns a different result on alternate calls?