1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Oracle 9i SQL CASE Statement Limitation

Discussion in 'SQL PL/SQL' started by ygsunilkumar, May 8, 2009.

  1. ygsunilkumar

    ygsunilkumar Active Member

    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    80
    Limited to 255 comparisons in CASE statement. Each WHEN ... THEN pair is considered 2 comparisons. To avoid exceeding the limit of 128 choices, you can nest CASE expressions. That is return_expr can itself be a CASE expression.

    What is 128 choices?
     
  2. tyro

    tyro Forum Genius

    Messages:
    368
    Likes Received:
    20
    Trophy Points:
    260
    Location:
    India
    i think it means that you can have a total of 255 comparison. So when you write WHEN something... THEN something you are actually doing two comparisons, one after WHEN and another after THEN. So in effect you can only have 128 conditions to compare in straightforward CASE statements.

    SO the above statement is saying that if you want to do more than 128 comparisons, you should use nested CASE expressions.
     
    ygsunilkumar likes this.