Issue with sorting results on the basis of specfic values.

Hello,
I written an sql that will sort the results on the basis of values defined in 'IN' clause. I have made use of CASE statement in ORDER BY clause. Its not functioning. My code is:
SELECT GWLO.productcode,
          GWLA.parentsampletype,
          GWLO.sampletype SampleType,
          max(GWLA.loginid) Loginid,
          max(GWLA.modifiedts) modifiedts
     FROM gwloginattribvars GWL,
          gwloginkeyvals GWLO,
          gwloginkeysadmin GWLA
     WHERE GWLO.productcode = GWLA.productcode
          AND GWLO.sampletype = GWLA.sampletype
          AND GWLO.productcode in ('1002124', 'ABPG', 'ABIG')
          AND GWLO.sampletype <> 'CERTIFICATE-OF-ANALYSIS'
          AND GWLA.parentsampletype IS NOT NULL
     GROUP BY GWLO.productcode, GWLA.parentsampletype, GWLO.sampletype
     ORDER BY
          (CASE GWLO.productcode WHEN '1002124'     THEN 1
               WHEN 'ABPG'     THEN 2
               WHEN 'ABIG'     THEN 3
               ELSE 'LL'
               END) ASC
I expected the results to be in sequence what it is defined in CASE - ORDER By clause. This code is givin me error. The error is
(CASE GWLO.productcode WHEN '1002124' THEN 1
ERROR at line 16:
ORA-00907: missing right parenthesis
Please help. Thanks!

     ORDER BY
          (CASE GWLO.productcode WHEN '1002124'     THEN 1
               WHEN 'ABPG'     THEN 2
               WHEN 'ABIG'     THEN 3
               ELSE 'LL'>                END) ASC
Can u just explain me in this context? I think it should be another number in the else part - since you are returning numbers in all the 'WHEN' option. Pls explain it.
Regards.
Satyaki De.

Similar Messages

  • Anyone else having issues with location services since the 7.1 update? Ever since I updated i've been seeing the location services on my status bar at all times.

    Anyone else having issues with location services since the 7.1 update? Ever since I updated i’ve been seeing the location services icon on my status bar at all times. I noticed that google was the app that was using it a lot, but after I turned the feature off for google my phone started using the “traffic”, “frequent locations” and “cell network search”. When I turn the feature off for all of those things it’s no longer a problem. So just wondering if anyone else is having this issue or if anyone has a solution?

    The "solution" is probably to increase your knowledge.  You've done good things.  Perhaps this article will educate you a bit more about location services.
    Basically, they can be very useful, but can cause a lot of iPhone use.  A major example is "Remind me to ... when I leave home."
    http://support.apple.com/kb/HT5594

  • I have Iphone 5 and have an issue with deleting part of the messages in Imessage conversation. The trash button is not displayed to delete part of the imessage. I see only delete all option. Is it a bug?

    I have Iphone 5 and have an issue with deleting part of the messages in Imessage conversation. The trash button is not displayed to delete part of the imessage. I see only delete all option. Is it a bug?

    Hi An Iphone user,
    If you are having issues deleting a specific message from an iMessage conversation (not seeing the Trash icon), you may want to double-check that you are following the steps outlined in the following article:
    How do I delete a message?
    To delete a message, tap and hold the message bubble, then tap More.
    Tap Delete All to delete all the messages. Or tap to select the messages you want to delete, then tap .
    After you delete a message, you can recover it only by restoring from a backup.
    Send messages with your iPhone, iPad, or iPod touch - Apple Support
    Regards,
    - Brenden

  • Issue with displaying summary in the Page Bottom

    Hi Friends,
    I have an issue with displaying summary in the page bottom. for this i am using command BOTTOM and ENDBOTTOM in Main Window.
    I designed 2 pages are First and Next, in the first it displays PO Header details and Item details in the Main window and also Item details continuious in the Next Page also.
    If the lines are enough in Bottom then it displays the summary. But if the lines are not enough in bottom then it does not trigger the new page, so that it doesn't displays the Summary in Bottom.
    for ex: Total lines of the page 50 and Bottom required 15 lines. In the next page contains upto 35 lines, it triggers the Bottom.
    But if the lines are more than 35 and below than 50, it does not trigger the new page so that it does not shows the bottom.
    Please help me on the same, this is very urgent.I will give a rewatrd if it is helful.
    Regards,
    Subbarao

    HI,
    Try with printing the bottom data with Protect and ENDPROTECT along with your Bottom and endbottom.
    Eg: Protect
    bottom
    text
    endbottom
    endprotect.
    Regards,
    Venkatesh

  • Hi BC, I have an issue with BC. When the shopping cart is used it takes stock out of inventory and h

    Hi BC,
    I have an issue with BC. When the shopping cart is used it takes stock out of inventory and holds it, regardless of whether or not a customer proceeds to purchase. OK.
    To make matters worse, the stock is only cleared from the shopping cart when the customer closes the browser - not when they close the shopping window.
    Now lets say a customer doesn't close their browser for a month - it happens! .. when their stock is finally returned it may throw out our stock levels that have in the meanwhile been adjusted. So their stock will be added on top of an accurate stock take, putting stock in that isnt really available.
    This is causing us mayhem.
    We have not yet seen if stock is actually returned at all. In the test we did today where we filled a shopping cart then closed the browser without making a purchase, the stock was not returned immediately. So we dont even know when it will be returned - thats IF a customer actually closes their browser. Any solutions out there?
    Jo

    Hi there,
    The way stock is managed in this situation is desirable for many in that case otherwise shopping on a site and adding to cart would not be viable or use friendly.
    What you mention about not closing a browser though is a case that is not true. IF you go into the shop settings in the admin you can see the cart restore timer which is by default 24 hours but you can change this to as low as 1 hour if you wish.

  • How can I stop receiving email automatically from the community when they have issues with there problems regarding the apple products.

    How can I stop receiving email automatically from the community when they have issues with there problems regarding the apple products.

    Click here for the instructions on stopping the emails.
    (85713)

  • I am having issues with being kicked off the internet intermittently. ATT says its not an issue with their service. Does anyone have an idea?

    I am having issues with being kicked off the internet intermittently. ATT states its not an issue with their service. Any ideas?

    Yes it is NOT your internet service. It is Apples OSX. It seems to be happening to older computers trying to run the newer OSX ( Mavericks and newer). I have a 2009 iMac I bought with Leopard installed, I upgraded to Snow leopard 10.6.8 and my computer was running flawlessly. I upgraded to Mountain Lion and I noticed my computer running slower... kind of annoying having to wait longer for everything (start up, browsers opening up, apps opening up, mail opening up and so on) Mavericks came out for free and I was excited to get out of this issue. Well, everything went from bad to terrible! Fast user switching had a glitch with desktop picture resetting to the wave, mail rules didn't work properly and I kept getting kicked off the internet (Absolutely NOTHING wrong with my internet). No one could figure out what was going on or how to fix it, even senior Apple tech's! After 3-4 months of searching, troubleshooting and waiting for a fix, I looked at my Mac Pro running Tiger 10.4.11 with no issues what so ever... that is when I made an executive decision. GO BACK TO SNOW LEOPARD! Since May 2014 I have been running 10.6.8 on my 2009 iMac and it has been smoking fast with NO issues what so ever, especially since I maxed out my memory for Mavericks. So to sum it up: some people might get lucky with old machines running new operating systems, but for the most part, it seems older processors can't keep up with the new sophisticated operating systems. Mavericks... Yosemite... FREE UPGRADE! But you will pay the price

  • When I open a new tab, an unwanted website opens instead of my desired home page. THIS IS ONLY AN ISSUE WITH NEW TABS; (opening the web browser AND clicking on the home button frings me to my desired home page.)

    When I open a new tab, an unwanted website opens instead of my desired home page. THIS IS ONLY AN ISSUE WITH NEW TABS; (opening the web browser AND clicking on the home button frings me to my desired home page.)
    I have attached the url of the unwanted site.

    Use this add-on [https://addons.mozilla.org/en-US/firefox/addon/custom-new-tab/ '''Custom new tab'''].

  • I am exporting a 2 min video, using a custom compressor setting. i have not had issues with this setting in the past, but recently its taking upwards of 4 hours to process. Any idea what is going on?

    I am exporting a 2 min video, using a custom compressor setting. I have not had issues with this setting in the past, but recently its taking upwards of 4 hours to process. Any idea what is going on?

    Name: Vimeo HD Encode
    Description: No description
    File Extension: mov
    Estimated size: 2.3 GB/hour of source
    Audio Encoder
              AAC, Stereo (L R), 44.100 kHz
    Video Encoder
              Width: 1920
              Height: 1080
              Pixel aspect ratio: Square
              Crop: None
              Padding: None
              Frame rate: (100% of source)
              Frame Controls On:
                        Retiming: (Best) High quality Motion Compensated
                        Resize Filter: Statistical Prediction
                        Deinterlace Filter: Best (Motion Compensated)
                        Adaptive Details: On
                        Antialias: 0
                        Detail Level: 0
                        Field Output: Progressive
              Codec Type: H.264
              Multi-pass: On, frame reorder: On
              Pixel depth: 24
              Spatial quality: 75
              Min. Spatial quality: 25
              Key frame interval: 30
              Temporal quality: 50
              Min. temporal quality: 25
              Average data rate: 5.12 (Mbps)
    Compatible with Mac
    My video in the timeline is 1920 x 1080 / 23.98 fps
    I've installed Toast and photoshop elements recently, i also updated my apps the other day.
    I have had this problem before the updates of the apps though

  • Issues with play back in the time line

    I am having issues with play back in the time line.
    am working with footage captured off a DVCAM Tape in a DV/DVCPRO NTSC Time line.
    My settings are set to match the source footage so I dont have to render. What ends up happening is the footage at times plays fine and smooth and then out of no where it will start playing choppy. like its lagging. But the Audio stay fine. I use to have to problem before but then it stopped.
    Now its back and I can not figure out why it does this. Usually a restart of the system would help solve it but now it still keeps coming back.
    i have tried different settings in the RT menu and still seem to be having the same problem.
    i am running the footage of 3 1TB drives in Raid0 and the System has 16GB of Ram. So I dont see this being the issue.
    any ideas?

    of course not, the system boots from a 320GB Western Digital Hard Drive. (the one that came with the system)
    I have a feeling that its not the Hard Drive, but no idea what it could be.

  • Having an issue with a page in the internet

    Hello,
    I registered to the forum a few days ago but did not introduce myself. Please accept my apology.
    I have a Blackberry style 9670 model, of which I am very happy with.
    I was having an issue with a page in the internet, in which I was receiving errors on my device. My daughter has a Blackberry Curve and she was able to access the page without any errors. I can not figure out why I do.
    Thanks

    I am not sure if this is the same issue but there was a bug that caused small exchange numbers to become negative which was resolved in one of the 11.1.1.3 patches, it is worth logging into My Oracle Support and having a look at the patches available.
    9588147 – In exchange rates table, entering very small values become negative after you save the data forms. For example, 0.000071 becomes –7.1E-5 after you save the exchange rate.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Does anyone have issues with your battery in the iPhone 5 having to be recharged 2 to. 3 times daily?

    Does anyone have issues with your battery in the iPhone 5 having to be recharged 2 to. 3 times daily?

    Only concrete way is to use it less sorry see here every method possible has been tried
    https://discussions.apple.com/thread/4329696?start=2970&tstart=0

  • Is anyone else having issues with their mail , where the reply from the person you just contacted contains very old emails from a different contact ?

    Is anyone else having issues with their mail , where the reply from the person you just contacted contains very old emails from a different contact ?

    I mean that I sent an email to a contact of mine yesterday. His reply contained a stream of very old emails I had received in 2009 from a totally different contact all together !! The reply email was in my inbox as being from the original person I sent the email to. This is starting to happen more regularly now , so is a problem !

  • Need Reports  in decrreasing order on the basis of measure value

    Got ASO Cube (3 dimensions) and have some records on it.
    Product/Enity/Measure
    Prod1 ent1 678
    prod2 ent1 700
    prod3 ent1 500
    when i retrive reports ,
    Can i able to get a reports in the decreasing order on the basis of Measure values like below ? (using any code or scripts)
    Prod2 ent1 700
    Prod1 ent1 678
    prod3 ent1 500

    If you are using the classic addin or report scripts, you can get the values in decreasing order. To do it in the add-in you can either use freeform with a report script or better yet, use the query designer to create and save the report. IF you are using a report script, you can set a sort descending and also a top x to only bring back a certain number of members. I'm not sure if the same is available through smartview. Using MDX you can do a topcount function

  • How to check radio button as default on the basis of database value?

    Hi Friends,
    I have one jsp, in which I am having a field of radio button, which have two boolean values of 0 & 1. I want to check the radio button as default on the basis of database value, kindly help me out.
    Thanks a lot in advance. Please help me out.

    probably, when using struts you should do all your calculations in action class it self
    Eg. in jsp
    <html:radio name="myForm" property="myProperty" value="0">0</html:radio>
    <html:radio name="myForm" property="myProperty" value="1">1</html:radio>
    in Action class
    if (databaseValue == 0)myForm.setMyProperty(0);
    else if (databaseValue == 1)myForm.setMyProperty(1);
    rest will follow
    whatever be the value it will come selected

Maybe you are looking for