Home » SQL & PL/SQL » SQL & PL/SQL » trouble in selecting case (oracle 8i)
trouble in selecting case [message #324089] Fri, 30 May 2008 14:56 Go to next message
melvinRav
Messages: 43
Registered: April 2008
Location: India
Member
Hi all,
i got a doubt with my case statement is there any difference between the first set of case statement and my second set

SELECT SUM(CASE 
             WHEN FY_YEAR = TO_NUMBER(TO_CHAR(SYSDATE,'YYYY'))
               THEN CASE 
                      WHEN FYP_SEQ = 5 
                        THEN CASE 
                               WHEN SLT_CODE1 IN ('C','S') 
                                 THEN QTY_SOLD
                              END
                    END
           END) TESTSUM
FROM   TABLE1

my second set
SELECT SUM(CASE 
             WHEN FY_YEAR = TO_NUMBER(TO_CHAR(SYSDATE,'YYYY'))
                  AND FYP_SEQ = 5 
               THEN CASE 
                      WHEN SLT_CODE1 IN ('C','S') 
                        THEN QTY_SOLD
                    END
           END) TESTSUM2
FROM   TABLE1

[Updated on: Fri, 30 May 2008 15:30] by Moderator

Report message to a moderator

Re: trouble in selecting case [message #324096 is a reply to message #324089] Fri, 30 May 2008 15:32 Go to previous messageGo to next message
Michel Cadot
Messages: 64133
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
No difference, you can even ANDed the last one into the case.

Regards
Michel
Re: trouble in selecting case [message #324134 is a reply to message #324096] Sat, 31 May 2008 01:56 Go to previous message
melvinRav
Messages: 43
Registered: April 2008
Location: India
Member
Thanks Michel
Previous Topic: Ora-03106 fatal two task communication protocol error
Next Topic: DESC not able to display the column name
Goto Forum:
  


Current Time: Thu Dec 08 04:19:26 CST 2016

Total time taken to generate the page: 0.11830 seconds