Wednesday 28 December 2011

NVL vs Coalesce


  • NVL is an Oracle Function. Hence works perfect in Oracle, may or may not work on other RDBMS softwares.
  • Coalesce is an ASCII function. Hence works perfect on any RDBMS software.
  • NVL can implicitly convert datatypes. But Coalesce cannot.

    Example:




     
  • Syntaxes:    NVL (expr1, expr2 )
    Coalesce( expr1, expr2 )
  • Coalesce executes faster than NVL. (~ 0.5 times ). This is because, NVL evaluates both the arguments and Coalesce evaluates only first argument.

No comments:

Post a Comment