Case and decode statement

Hi all,
could anyone would be able to tell me which statement is faster among decode and case and why?
thanx
Newbie

user531731 wrote:
The difference is in the syntax, and case statement is standards compliance and decode function is a user defined function.I guess you mean: CASE is an ANSI standard, while DECODE is an Oracle Specific function

Similar Messages

  • Difference between CASE and DECODE

    Hi All,
    Could you please explain me the basic differences between the CASE and DECODE, which performs fast...?
    DECODE is Oracle one, and the CASE is ANSI standard.
    As per my knowledge, CASE is a statement and DECODE is a function which was defined in the Standard package.
    If we use DECODE, the package has to load first, so it will take a little longer than the CASE. CASE is a simple statement which is ANSI standard.
    We can use the CASE in the where clause and can not use the DECODE in the where clause.
    Please clarify me and correct me if anything wrong.
    Thanks,

    IMO, the main important point is the way CASE and DECODE handles NULL
    SQL> select ename,comm,
      2         decode(comm,300,'A',null,'B','C') dcd,
      3         case comm when 300 then 'A'
      4                   when null then 'B'
      5                   else 'C'
      6         end cs
      7  from emp;
    ENAME            COMM D C
    SMITH                 B C --"DECODE treats NULL=NULL. But for CASE, NULL is not equal to "another" NULL
    ALLEN             300 A A
    WARD              500 C C
    JONES                 B C
    MARTIN           1400 C C
    BLAKE                 B C
    CLARK                 B C
    SCOTT                 B C
    KING                  B C
    TURNER              0 C C
    ADAMS                 B C
    JAMES                 B C
    FORD                  B C
    MILLER                B C
    14 rows selected.
    {code}
    Edited by: jeneesh on Jun 3, 2013 1:13 PM
    Note: in CASE, you should use IS NULL
    {code}
    case when comm=300 then 'A'
           when comm is null then 'B'
          else 'C'
    end
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Case and Decode query

    Hi,
    I am running below statement.
    create table test_abc
    (cnt number,
    outcome varchar2(20));
    insert into test_abc values(1,'EXISTINGDOMFUELCUST');
    insert into test_abc values(1,'Answer Phone');
    insert into test_abc values(1,'Answer Phone');
    insert into test_abc values(1,'Answer Phone');
    insert into test_abc values(1,'Answer Phone');
    insert into test_abc values(1,'Answer Phone');
    commit;
    Now I used case and decode
    select count(*),ot from (
    select (case when outcome ='EXISTINGDOMFUELCUST' then 'Existing Domestic Fuel Customer'
    when outcome='Answer Phone' then 'Answer Phone'
    when outcome='Answer Phone' then 'Answer Machine' end) ot
    from test_abc)
    group by ot;
    select count(*),decode(outcome,'EXISTINGDOMFUELCUST','Existing Domestic Fuel Customer','Answer Phone',
    'Answer Phone','Answer Phone','Answer Machine')
    from test_abc
    group by decode(outcome,'EXISTINGDOMFUELCUST','Existing Domestic Fuel Customer','Answer Phone',
    'Answer Phone','Answer Phone','Answer Machine')
    and getting same output
    cnt ot
    5 Answer Phone
    1 Existing Domestic Fuel Customer
    but I want output should be
    cnt ot
    5 Answer Phone
    5 Answer Machine
    1 Existing Domestic Fuel Customer
    please suggest

    Indra Budiantho wrote:
    /* Formatted on 8/28/2012 3:10:28 PM (QP5 v5.139.911.3011) */
    SELECT CASE
    WHEN outcome = 'EXISTINGDOMFUELCUST'
    THEN
    'Existing Domestic Fuel Customer'
    WHEN outcome = 'Answer Phone'
    THEN
    'Answer Phone'
    END
    outcome,
    COUNT (*)
    FROM test_abc
    GROUP BY outcome
    union
    SELECT CASE
    WHEN outcome = 'EXISTINGDOMFUELCUST'
    THEN
    'Existing Domestic Fuel Customer'
    WHEN outcome = 'Answer Phone'
    THEN
    'Answer Machine'
    END
    outcome,
    COUNT (*)
    FROM test_abc
    where outcome = 'Answer Phone'
    GROUP BY outcomeo/p
    Answer Machine     5
    Answer Phone     5
    Existing Domestic Fuel Customer     1This can be simplified..
    Also, UNION will unnecessarily do a distinct operation.
    SELECT CASE
                WHEN outcome = 'EXISTINGDOMFUELCUST'
                THEN
                   'Existing Domestic Fuel Customer'
                WHEN outcome = 'Answer Phone'
                THEN
                   'Answer Phone'
             END
                outcome,
             COUNT (*)
        FROM test_abc
    GROUP BY outcome
    union all
    SELECT 'Answer Machine'
                outcome,
             COUNT (*)
        FROM test_abc
        where outcome = 'Answer Phone'
    GROUP BY outcome

  • Regarding case and decode.

    Hi !
    I need to return all the employess, and indicate with "YES" or "NO" wherther they receive a commission.
    I am trying to get this by using CASE and DECODE but result is comming different.
    USING DECODE:
    SELECT ename,
    sal,
    DECODE(comm,NULL,'NO',
    'YES') COMM
    FROM emp;
    USING CASE:
    SELECT ename,
    sal,
    CASE comm
    WHEN NULL THEN 'NO'
    ELSE 'YES'
    END
    FROM emp;
    DECODE is returning actual data(comm is NO where comm is null and comm is YES where comm is not null). Where as CASE is retunring YES for all employees commission even comm is null..
    I am not able to understand where I was wrong.
    Can any one help me out?
    Thanks
    Rajesh

    Hi Rajesh,
    I tried to solve your query this way, check if it serves the purpose
    /***Using Decode***/
    SELECT EMPLOYEE_ID, DECODE(NVL(COMMISSION_PCT, 0), 0, 'NO', 'YES')
    FROM EMPLOYEES
    /****Using Case***/
    SELECT EMPLOYEE_ID, CASE NVL(COMMISSION_PCT, 0)
    WHEN 0 THEN 'NO'
    ELSE 'YES'
    END CASE
    FROM EMPLOYEES
    /

  • Pls tell me difference between case and decode

    Hi all
    pls tell me difference between case and decode
    regards

    Well not entirely true when you consider working with
    sign and decode together. Your example could be
    written with decode and sign like this:
    decode(sign(sal-1000),1,sal+comm,-1,sal,0)But the case expression reads more easily, I admit.Rob it was just example you considered it special case ,BTW can you do it for me by DECODE function.
    SQL> SELECT sal,comm,CASE WHEN sal>1000 AND sal<1300 THEN sal+comm ELSE 0 END
      2    FROM emp
      3  /
           SAL       COMM CASEWHENSAL>1000ANDSAL<1300THENSAL+COMMELSE0END
          5000                                                          0
          2850                                                          0
          2450                                                          0
          2975                                                          0
          1250       1400                                            2650
          1600        300                                               0
          1500          0                                               0
           950                                                          0
          1250        500                                            1750
          3000                                                          0
           800                                                          0
           SAL       COMM CASEWHENSAL>1000ANDSAL<1300THENSAL+COMMELSE0END
          3000                                                          0
          1100
          1300                                                          0
    14 rows selected.Note for OP CASE can be used within PL/SQL witing ORACLE 9i or later release
    but DECODE function can only be used within SQL.
    Khurram

  • Help needed in writing SQL CASE or DECODE statement

    Hi experts,
    I need to write a SQL to select order_num, cntry_cde, prod_id and Qty by joining order_num on PROD_ORDER and PROD_ORDER_TXT.
    Here is my sample data
    PRODORDER_               
    order_num     cntry_cde     Prod_id     Qty
    100     US     A1     5
    101     US     A2     10
    102     AU     A3     4
    103     AU     A4     9
    104     IN     A5     3
    PRODORDER_TXT_               
    order_num     cntry_cde     Prod_id     
    100     US     A1     
    101     US     A2     
    102     NZ     A3     
    103     AU     A4     
    104          A5     
    Here is the requirement,
    1) If the cntry_cde in PROD_ORDER is same as cntry_cde in PROD_ORDER_TXT then select PROD_ORDER.cntry_cde (orders 100, 101, 103)
    2) If they are different, pick the country code from PROD_ORDER_TXT (order 102, AU <> NZ)
    3) If they are different and PROD_ORDER_TXT.cntry_cde is NULL, I cannot use it as cntry_cde in my report (order 104). It happenend just because of the bad data at source.
    I cannot avoid it. Then simply use the cntry_cde from PROD_ORDER
    Output expected
    100     US     A1     5
    101     US     A2     10
    102     NZ     A3     4 -- AU changed to NZ
    103     AU     A4     9
    104     IN     A5     3 -- IN retained as PROD_ORDER_TXT.cntry_cde is null
    sample table creation and insert statements are below
    create table prod_order
    (order_num number,
    cntry_cde CHAR(2),
    prod_id VARCHAR2(6),
    qty number)
    create table prod_order_txt
    (order_num number,
    cntry_cde CHAR(2),
    prod_id VARCHAR2(6))
    insert into prod_order values (100, 'US', 'A1',5);
    insert into prod_order values (101, 'US', 'A2',1);
    insert into prod_order values (102, 'AU', 'A3',4);
    insert into prod_order values (103, 'AU', 'A4',9);
    insert into prod_order values (104, 'IN', 'A5',3);
    insert into prod_order_txt values (100,'US','A1');
    insert into prod_order_txt values (101,'US','A2');
    insert into prod_order_txt values (102,'NZ','A3');
    insert into prod_order_txt values (103,'AU','A4');
    insert into prod_order_txt values (104,NULL,'A5');
    commit;
    Thanks for your help in advance
    Edited by: sarvan on Mar 28, 2012 1:39 PM

    Hello
    Thank you for posting all of the ddl and test data along with your expected output - very helpful!. One small point would be to remember to type {noformat}{noformat} before and after any section of code or data in your post so that formatting is retained.  Anyway, this should be a simple join and a combination of CASE and NVL...Select
    po.order_num,
    CASE
    WHEN po.cntry_cde != NVL(pot.cntry_cde,po.cntry_cde)
    THEN
    pot.cntry_cde
    ELSE
    po.cntry_cde
    END cntry_code,
    po.prod_id,
    po.qty
    FROM
    prod_order po
    JOIN
    prod_order_txt pot
    ON
    ( po.order_num = pot.order_num
    ORDER_NUM CN PROD_I QTY
    100 US A1 5
    101 US A2 1
    102 NZ A3 4
    103 AU A4 9
    104 IN A5 3
    5 rows selected.
    HTH
    David
    Edited by: Bravid on Mar 28, 2012 8:32 AM
    corrected !=                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to use case and decode to extract the data

    Hello PL/SQL Gurus,
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production version
    I have a table in following format -
    drop table TT2;
    create table TT2(College, Class,gender,status,fees) as select
    'IITB','MBA','M','P',255600 from dual union all select
    'IITK','MTech','M','P',300000 from dual union all select
    'IITD','MBA','F','P',450000 from dual union all select
    'IITKH','MBA','F','P',350000 from dual union all select
    'IITC','MTech','F','P',420000 from dual union all select
    'IITB','MTech','M','P',185000 from dual union all select
    'IITC','MTech','M','P',235000 from dual union all select
    'IITD','MBA','F','F',175000 from dual union all select
    'IITM','MBA','M','F',257000 from dual union all select     
    'IITKH','MTech','F','P',335000 from dual union all select
    'IITD','MBA','F','P',540335 from dual union all select
    'IITC','MBA','F','F',125089 from dual union all select
    'IITD','MTech','M','P',290756 from dual union all select
    'IITM','MBA','M','P',200000 from dual union all select     
    'IITKH','MBA','F','F',534990 from dual union all select
    'IITD','MBA','F','P',221000 from dual ;some of the extraction conditions are as following -
    CASE CONDITION
    College in 'IITB' and status='P'- 'WestRegion Passed'
    College in 'IITC' and status='P'- 'SouthRegion Passed'
    College in 'IITD' and 'IITK' and status='P' and Gender='F' - 'NothRegion Female Passed'
    College not in 'IITK' and status='F' - 'Ex Kanpur Failed'
    Expected output -
    Region Statnding     Fees
    WestRegion Passed     440460
    SouthRegion Passed     655000
    NothRegion Female Passed     1386335
    Ex Kanpur Failed     1092079SQL Used
    I am using the following query which only make sure of case but this is not how i want the output , if i try to use the case within decode then how to work on this -
    SELECT (CASE WHEN College in ('IITB') and status='P' then sum(fees) else 0 end) WP,
    (case when College in ('IITC') and status='P' then sum(fees) else 0 end) SP,
    (case when College in ('IITD','IITK') and gender='F' and status='P' then sum(fees) else 0 end) NFP,
    (case when College in ('IITK') and status='F' then sum(fees) else 0 end) ExKF
    FROM
    TT2
    GROUP BY College, Class,gender,status

    user555994 wrote:
    Thank you so much jeneesh i am really thankful to you ...vov.
    one more query in case if any of the selection don't have the output data , then values will be displayed like -One way..
    with t as
    --"Add all your descriptions
    (select 'WestRegion Passed' region_standing from dual union all
    select 'SouthRegion Passed' region_standing from dual union all
    select 'NothRegion Female Passed' region_standing from dual union all
    select 'Ex Kanpur Failed' region_standing from dual)
    select region_standing,sum(fees) fees
            from (
            (SELECT CASE WHEN College in ('IITB') and status='P'
                                then 'WestRegion Passed'
                        when College in ('IITC') and status='P'
                                then 'SouthRegion Passed'  
                        when College in ('IITD','IITK') and gender='F' and status='P'
                                then 'NothRegion Female Passed'
                        when College in ('IITK') and status='F'
                                then 'Ex Kanpur Failed'
                        else 'Others' end region_standing,
                        sum(fees) fees
            FROM TT2
            GROUP BY  CASE WHEN College in ('IITB') and status='P'
                                then 'WestRegion Passed'
                        when College in ('IITC') and status='P'
                                then 'SouthRegion Passed'  
                        when College in ('IITD','IITK') and gender='F' and status='P'
                                then 'NothRegion Female Passed'
                        when College in ('IITK') and status='F'
                                then 'Ex Kanpur Failed'
                        else 'Others' end
            union all
            select region_standing,0
            from t
    group by   region_standing;
    REGION_STANDING              FEES
    Others                     2567835
    NothRegion Female Passed   1211335
    WestRegion Passed           440600
    Ex Kanpur Failed                 0
    SouthRegion Passed          655000
    {code}
    Edited by: jeneesh on Nov 5, 2012 5:07 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Case and decode - nested functions

    Can i use a case statement inside a decode or nvl2 function?
    eg.
    decode(col_a,'ABC',
    case when col_b in (1,2) then 'CCC' else when col_b in (3,4,5) then 'XXX' end
    , 'NA')
    Can i use a function like this basically, can i nest a case statement within a decode or nvl2 function?
    I have used nested decodes and nvls and nested case statements but not combined both so far.... so need an opinion...
    Thanks.
    Edited by: user254668 on Apr 30, 2010 1:35 PM

    user254668 wrote:
    Can i use a case statement inside a decode or nvl2 function? Absolutely. Just get rid of that else:
    decode(col_a,'ABC',
    case when col_b in (1,2) then 'CCC' when col_b in (3,4,5) then 'XXX' end
    , 'NA') SY.

  • Case and if statements in Ehancment points

    Hi Friends
    I have a standard code
    "Standard code
    IF <condition>.
    "In between i have an enhacment point
    Enhancment point.
    enhancment.
    ELSEIF <condition1>
    endenhacment.
    ENDIF.
    I get an error no if condition or no endif within the
    enhacment point.
    Is there a workaound for this

    Hi.  Hema is right; it's a nesting problem.  I'm not sure exactly what statements you're using for your enhancement, but your conditions can't overlap like that. If the "ELSEIF" condition belongs to the original "IF" statement, then the enhancement needs to be completely contained either before or after the "ELSEIF".  If the "ELSEIF" belongs to the enhancement, then you need to have an "IF" and "ENDIF" within the enhancement.  Here's what I mean.
    "ELSEIF" belongs to first "IF":
    IF <condition1>.
      enhancement.
      endenhancement.
    ELSEIF <condition2>.
    if the enhancement code needs to be here as well,
    then repeat it on this side of the ELSEIF or put the
    code in a form and call it from both places
    ENDIF.
    "ELSEIF" belongs to enhancement:
    IF <condition1>.
      enhancement.
        IF <condition1a>.
        ELSEIF <condition1b>.
        ENDIF.
      endenhancement.
    ENDIF.
    I hope this clarifies things a bit.
    - April King

  • EDQ - Writing CASE or DECODE statement

    Test
    Edited by: user4362313 on May 3, 2013 5:00 AM

    Hi Bala,
    If I've interpreted the statement correctly then you're wanting to pad the digits to the left of a decimal point to four characters, so 12.345 becomes 0012.345.
    The easiest way to achieve this is by using an Expression processor [see the online help for full syntax details]. Assuming the input attribute is called "col1" then the following expression should acheive the desired result:
    substr("000" || col1, indexof(col1, ".") - 1)
    regards,
    Nick

  • Regarding case statement and decode function

    Hi Experts,
    I have question.....regarding case statement and decode statement....
    Can you please explain me that which one will be efficient,to place in insert statement...
    insert statement(
    (case when ........then
                         case when ....then
                         else
                         end)
      else
    end)
    or
    insert statement(
    case when.....then
    decode(....)
    else
    end)
    Can you people explain me which one is more efficient method?
    Thanks in advance.......

    The are major differences to talk about in case of CASE vs DECODE, but performance wise both are pretty much the same.
    Have a look at Tom's thread
    Ask Tom &amp;quot;better performance - case or decode&amp;quot;
    I would suggest to use CASE whenever possible. Don't worry about the performance part.

  • Case or decode in select statement for comparison

    Hi,
    How can I do a comparison
    like
    if sal < 50, output 1.1 * comm
    if sal > 50 and < = 100 output 1.2 * comm
    else output comm
    in a single select statement.
    I tried using case and decode but I am not sure how to use it in comparison operations.
    Please help

    use the 'case' construct:
    SELECT
    NORMAL_FIELD
    , (CASE
    WHEN (SAL < 50) THEN 1.1 * COMM          
    WHEN (SAL > 50) AND (SAL <= 100) THEN 1.2 * COMM
    ELSE COMM                    
    END
    ) AS CALCULATED_COMM
    FROM
    TB_xxxx
    WHERE xxxx
    hope this helps

  • CASE vs DECODE - CASE with SUM and All in Page Item is non aggregable

    Hi,
    I'm using Discoverer 9.0.4.
    After switching calculations from DECODE to CASE
    I found out that case gives a non aggregable result when using a Page Item and selecting <All>.
    The calculations
    (SUM x) / (SUM y)
    or
    (x SUM) / (y SUM)
    where x and y are variables, work fine with page item <All>.
    But for example:
    CASE WHEN 1=2 THEN 1 ELSE (SUM x) / (SUM y) END
    gives non-aggregable.
    The same code works with DECODE:
    DECODE(1,2,1,(SUM x) / (SUM y))
    and is aggregable.
    Does anyone know a reason or a way to make it work with CASE?
    Thanks,
    Joao Noronha
    P.S.: I wanted <= comparisons and CASE is the best in simplicity,
    but now I know I can do it with DECODE, still looking ok using LEAST instead of ABS of the difference.

    Hi there
    I think therefore you have answered your own question and determined that using CASE in aggregations is not a good idea. I only threw out the two CASE options as ideas not as solutions, just in case (pardon the pun) one of these worked in your situation.
    Your comment I must say that if it worked it would give a wrong result (the sum of the divisions is not the same as the division of the sums) may give the wrong answer in your case but may be correct in others. It just depends how the items in the folder have been set up. I agree though that SUM(x) / SUM(y) will more often than not give the right answer.
    This discussion about DECODE vs CASE has been going on ever since Oracle introduced CASE as a means of placating a younger breed of user who needed an IF..THEN...ELSE construct and could not get their minds around the intricacies of DECODE. The DECODE is a much more reliable function than CASE because it has been around for a long time allowing Oracle plenty of opportunity to iron the bugs out of it. If I get a chance I will always use a DECODE whenever aggregations are required. However, when no aggregations are in use then I'll use CASE, simply because it's easier for users to work with.
    Unfortunately, users need to work with aggregations and so I don't see any alternative to Plus users having to learn DECODE. Whenever I teach Plus I always teach the users both CASE and DECODE but point out that DECODE has fewer issues that CASE. Oh, and talking of issues, try getting the THEN and ELSE components to return a different datatype. CASE has a fit and will not compile.
    Best wishes and glad you got your issue solved - you did right?
    Regards
    Michael

  • Case in Update statement

    hi,
    How to use the case or decode statement in Update statement.

    Welcome to Oracle Technology network!
    This forum is for SQL*Developer issues - things realed directly to Oracle's SQL*Developer product. Your quesiton about CASE statements in UPDATES is a general SQL question. You will get a better answer if you close this thread and open it again in the SQL and PL/SQL forum which is for SQL questions

  • CASE or DECODE - what is faster?

    when i use them in select clause with varchar2 or number datatype? (Oracle 10.2 EE)
    regards

    Hi,
    This helped me in understanding the difference between case and decode
    Quoting from an expert amoungst experts Billy Verreynne. here is what he says:
    From what i know, in case of multiple condition checking, Case is simpler to write when compared to Decode. Also Decode can not be used in PL/SQL code where as CASE is possible.
    There is very little performance difference between CASE and DECODE on the same platform. One has to run 100's of 1000's of iterations to see a difference, and even then it is debatable of whether that difference is just due to the CASE vs DECODE.
    There seems to be a difference in performance between CASE and DECODE depending on the type of CPU. On some CPU architecture a DECODE will seem to be just slightly faster. On others, the CASE will seem to be slightly faster.
    The performance difference is so slight that it makes very little sense in using that as primary criteria for whether to use CASE or DECODE. So unless you're calling this statement from a very tight loop doing millions of iterations, the decision should rather be which one, CASE or DECODE, best suits the need.
    Wrong question really.. unless you writing a very tight loop doing 100's of 1000's of iterations using that type of conditional structure. And even then performance difference will not be that significant.
    The right question to ask is which one is more flexible and allows for the programmer that comes after you to read and understand and maintain your code. The CASE statement is in this regard, a lot better than a DECODE statement.
    Looking just at performance (which I suggest you do not do in isolation!!), I get mixed results using 10G Enterprise on different platforms (HP-UX vs SUN AMD) and operating systems (HP-UX vs Linux).
    On the former the DECODE is slightly faster. On the latter the CASE is slightly faster.
    Using the construct you've specified and doing a tight loop of a 100,000 iterations, the elapsed execution times are:
    HP-UX DECODE = 00:00:11.83
    HP-UX CASE = 00:00:12.32
    Linux/AMD DECODE =00:00:02.02
    Linux/AMD CASE = 00:00:01.84
    Obviosuly the CPU architecture plays a major role here. The AMD is considered as the best 64 CPU on the market. The HP-UX PARISC CPU (also 64bit), does not really compare raw performance wise. In addition this is a RISC CPU whereas the AMD CPU is I believe more CISC than RISC.
    Also interesting that the faster Sun AMD/Linux server I used for this benchmark is about 10% the price of the HP-UX server.. and about 5x faster ito raw speed as this benchmark showed. :-)
    An interesting exercise, but one with little real world value. Yes performance is important. But within PL/SQL, not to the level about debating whether a CASE or DECODE is faster. As I've mentioned, I believe the right question being one about readability and maintenance and not performance in this case.
    Hope this helps and all credit goes to the expert billy.
    Edited by: Kevin CK on Aug 5, 2010 4:07 PM
    Edited by: Kevin CK on Aug 5, 2010 4:08 PM

Maybe you are looking for

  • Questions on

    I just have some questions on the RMA process through creative. I have a Zen Micro (5GB Silver) with the back button and play button sensitivity problem and I'd like to get it RMAed to attempt to get the issue resolved. What contents should be packag

  • Update to Photoshop Album SE3 from 2 and now cannot email

    My daughter uses Photoshop Album Starter Ablum to send photos to friends. Everything worked fine until she updated to 3. Now she is unable to send pictures by email. She uses AOL. The popup comes up and says to set email client to outlook. In the pre

  • ORA-04091: table ACCESSLOG is mutating, trigger/function may not see it

    Hi Got the following error ORA-04091: table ACCESSLOG is mutating, trigger/function may not see it i searched the error found that the problem is with FOR EACH ROW how can i handel this specifically with the following code: CREATE OR REPLACE TRIGGER

  • Switching Serial Number to new laptop

    Hello, The logicboard on my old laptop died, so I bought a new MacBook. I have downloaded Aperture and tried to use to serial number that I purchased (purchased over the web) for my new laptop. When I put the serial number in it is not recognized. I

  • HELP CANT UPDATE NOR RESTORE MY IPHONE4 ON ITUNES..

    as the title say i cant restore my iphone 4 on itunes. it seems that the restore and check for update button are dissabled but  i tried it on other iphone like 3g it works fine here is a sample screen shot. any help pls...