Results 1 to 1 of 1

Thread: Difference between decode and case statements / functions

  1. #1
    Senior Member vijay's Avatar
    Join Date
    May 2012

    Difference between decode and case statements / functions

    The differences between case and decode statements are listed below:

    • DECODE can work with only scalar values but CASE can work with logical operators, predicates and search-able sub queries.
    • CASE can work as a PL/SQL construct but DECODE is used only in SQL statements.CASE can be used as parameter of a function/procedure.
    • CASE expects data type consistency, DECODE does not.
    • CASE complies with ANSI SQL. DECODE is proprietary to Oracle.
    • CASE executes faster in the optimizer than does DECODE.
    • CASE is a statement while DECODE is a function.

    The search-able case statement is similar to the decode function. This is shown below:

    Case dept_id when 10 
                      then return_value1
                      when  20
                      then return_value2
                      else  return_value3
    Last edited by vijay; 02-27-2013 at 08:03 AM.

Similar Threads

  1. Replies: 0
    Last Post: 03-04-2013, 08:57 AM
  2. Difference between a Test Plan and a Use Case
    By Manoj Tiwari in forum Testing
    Replies: 1
    Last Post: 09-20-2012, 09:36 AM
  3. Replies: 2
    Last Post: 09-05-2012, 09:32 AM
  4. Replies: 1
    Last Post: 06-30-2012, 07:27 AM
  5. Replies: 1
    Last Post: 06-25-2012, 05:27 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts