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

Similar Messages

  • I have a comment.  I am very upset with Photoshop and all your tutorials regarding the quick select tool.  I have watched many tutorials and read instructions until I am blue in the face.  This tool does not work.  It is all over the place and all of your

    I have a comment.  I am very upset with Photoshop and all your tutorials regarding the quick select tool.  I have watched many tutorials and read instructions until I am blue in the face.  This tool does not work.  It is all over the place and all of your tutorials make it look so simple.  How can you advertise this as a viable tool when it just doesn't work?

    It is all over the place and all of your tutorials make it look so simple.
    This is a user to user Forum, so you are not really addressing Adobe here, even though some Adobe employees thankfully have been dropping by.
    How can you advertise this as a viable tool when it just doesn't work?
    Concluding something does not work because you fail at using it is not necessarily always justified.
    The Quick Selection Tool certainly has limitations, but your post seems to be more about venting than trouble-shooting – otherwise you might have posted an image where you failed to get an expected result.

  • I have set up all my mac devices to sync with iCloud and all work except for email. When I delete on one device, the delete doesn't occur on the other devices.

    I have set up all my mac devices to sync with iCloud and all applications work except for email. Incoming messages appear on all devices but when I delete on one device, the delete doesn't occur on the other devices.

    Thank you for your interest. I use apple mail to access my two accounts -I guess they are 3rd party accounts. One is a gmail acount and the other is a bigpond account. I admit to a lack of a high level of literacy when it comes to the language around all of this. For example, I am aware that I have an iCloud email account as I managed to set it up, but don't really understand the purpose of it as the last thing I need is yet another email account to oversee.

  • If i replace my iphone5. will i get a new iphone5 with box and all new accessories?

    if i replace my iphone5. will i get a new iphone5 with box and all new accessories?

    Vague.
    If you buy a new on , then yes you will get all of that.
    If it is replaced under warranty, then no.  You will get a service unit, could be a refurb, with no accessories - you need to keep everything but the iphone itself when you have it exchanged.

  • I applied a template to a page with SWFs and now that page does not play the SWFs. Why?

    I applied a template to a page with SWFs and now that page does not play the SWFs (just a blank area where the SWF should be). When I detach the template it will play the flash file. This site will eventually be updated via Adobe Contribute. And I just discovered that when applying a template to a page that uses HTML datasets (Master/Detail),it no longer reads the Master/detail regions and displays a blank. Any thoughts?
    [Moved to Dreamweaver forum by moderator]

    Firstly, you shouldn't really 'apply' a template to a page, you should create a child page by going to FILE>NEW>Page from Template.  Too many things can happen when applying a template the way you are doing it. eg:; editable and non-editable regions not matching up and being asked where to place these regions and in all likelihood, you end up with 2 or more of the same region.
    When a swf file is inserted into a page, a corresponding Scripts folder is written automatically is stored in the root of the site - it is also linked to in the head of the document. What I believe is happening is that when you apply a template to the page, the Template has no idea that there is a swf file on the page and is not aware of the correct link to the Scripts folder.  If you do a test and add the swf file to the template page itself, I bet that the links to the swf and the scripts folder are correct - because DW knows the correct path to the script file.   Hence the reason the page probably works when you detach it from a template.

  • My bookmark glasses icon is missing as well as the bookmark icon from preference pane.  The reading list is still there although completely grey colour and all the pages have the same blue icon. Can anyone advise how to fix this problem?  Mac os x 10.7 Sa

    My bookmark glasses icon is missing as well as the bookmark icon from preference pane. There is no + sign to add to the reading list.  The reading list is still there although completely grey colour and all the pages have the same blue icon. Can anyone advise how to fix this problem?  Mac os x 10.7.5  Safari 6.1.

    My bookmark glasses icon is missing as well as the bookmark icon from preference pane. There is no + sign to add to the reading list.  The reading list is still there although completely grey colour and all the pages have the same blue icon. Can anyone advise how to fix this problem?  Mac os x 10.7.5  Safari 6.1.

  • I'm on plan mode In Adobe muse, I have my paster page at the bottom and all subsequent pages at the

    I'm on plan mode In Adobe muse, I have my paster page at the bottom and all subsequent pages at the top. I've changed my page dimensions in the master page by altering the height, however, these changes have not been made in the subsequent pages up top. How come?

    Several possible reasons:
    1) Is the master page applied to the pages?
    2) Did you increase or decrease the height of the master? The size of actual pages is the maximum of the size of the applied master page and the size that's required to contain the content that's been laid out on the page.
    3) Has the minimum height of the non-master pages ever been set? If so, it overrides the master page value. To get the normal page to again honor the minimum height set in the master page go to the individual page in the Plan view and use the context menu to select "Reset Page Properties". This will revert all the page properties to match those of the applied master.

  • [JS][CS4] Remove all hidden page items?

    Hello,
    I'm trying to remove all hidden page items regardless of how many sublayers they are burried in. Is this possible? I wrote a snippet here that seems to only partly work. It removes all hidden page items unless two hidden items exist right after each other in the stacking order. Why would this be happening? Any suggestions?
    for (i=0; i<doc.pageItems.length; i++){
              if (doc.pageItems[i].hidden == true){
                   doc.pageItems[i].remove();
    I'm new to scripting so any help is greatly appreciated.
    Thanks!
    Lindsay

    What happens if you go from back to front? I think something like this
    #target illustrator
    var idoc = app.activeDocument;
    for (i = idoc.pageItems.length-1; i>=0; i--){
              if (idoc.pageItems[i].hidden == true){
                   idoc.pageItems[i].remove();
    Worked on a trial

  • SMQ2 - Found a queue with name "*" and all other queues stuck in STOP state

    Hi all,
    We have a problem on the ECC side, on outbound asynchronous proxies. Sometimes a new queue appears on SMQ2 there with name "", and with status "STOP". At this time, all other queues stuck with STOP status... the only way of resetting all those queues to RUNNING state again is to delete the queue named as ""...
    Some of you has any idea how this queue "*" appears there and stop all other queues?
    thanks
    roberti

    Hi Ravi,
    Is not only about one queue stopped... the problem is this queue named ""... with status STOP, all other queues stops too with it. The only way to make things work again is to delete the queue named as ""... the problem is to discover what or who is creating this stupid "*" queue. I think that this is a procedural error on datacenter, but they are saying is not the case... I'm investigating, but if someone else has any idea about I would appreciate
    thanks!
    roberti

  • Sql query data horizontally with sum and condition in a row

    I am trying to get data from the following query in a row with total but not succeed and getting error message. Please help and advise.
    Select empid,name,country,
    sum(case category when 'JOB' then sum(core+RR) else 0 end) as 'JOB-Sum',
    sum(case category when 'PRIVATE' then sum(core+PP) else 0 end) as 'PRIVATE-Sum',
    group by empid,name,country
    Note: Following query is good for getting result in one row but i have to put sum calculation with 'THEN' and want result in a row.
    SELECT ID, MAX(case when Col1 = 'Yes' then 1 else 0 end) AS Col1,
    MAX(case when Col2 = 'Yes' then 1 else 0 end) AS Col2
    FROM MyTable
    GROUP BY ID

    Please show some sample data and expected output.
    Regards,
    Rob.

  • Problem with iTunes (and all of iLife!!!) finding information on machine

    I just bought a new G5 Black Macbook, and had the Apple Store transfer my old profile from my G4 iBook in the past week. When i picked up my macbook, everything worked fine and all the pictures, music and personal preferences were transfered, but in the past day all programs act like i'm a new user, and do not register any of my old music, photos, or preferences. My iTunes library is located in its usual place, and all music is there, but Itunes seems not to see it, the same goes for iPhoto.
    The two things that have happened in between the computer working fine and this problem are: I have installed Growl, and renamed my home tab in finder. I'm not sure if either of these played a part, but its changes that have been made.
    Does anyone have any suggestions as to how to to solve this problem, or should i just take it all back to the Apple Store?

    Well all the songs are Mp3s, but I will try a CD. Also, as I mentioned, I tried a few converters for the videos, and Videora was one of them. The videos that I converted with Videora don't seem to want to import to iTunes, and the .mov files won't sync (For obvious reasons now I guess). I tried reinstalling iTunes and all sorts of stuff but they just don't want to work

  • Ipod Synced with PC and all data lost

    Hi, I have a new Ipod classic 120 GB. I normally use it with my macbook and all was good till yesterday my brother synced it with a PC and all data was lost. My Ipod has a few mp3 music flies which i cannot delete and gives me error code 61. It also refuses to be recognized by my macbook again although when i connect the itunes open in my macbook but doesnot read the ipod and does not sync. I have even tried to restore. The ipod pluged in icon appears on the screen. Any suggestions to help me get my data back from my macbook itunes would be much appreciated.

    DId you sync you iPod on another computer?  If so the photos are gone.
    Unless you synced/backed up your iPod after you had taken the photos and the backup still has the photos, the photos are gone.  You can go to iTunes>Preferences>DIvices and see the date of the backup.

  • HT201250 I do not understand how to restore my entire iTunes music library with Playlists and all?

    I do not understand how to restore my iTunes library inlcuding Playlists and all? In clearing out an older Powerbook I had not signed out of MobileMe when clearing iTunes. That deleted many songs and Playlists on the iMac and iPhone. Help is appreciated.

    And yes, I have a 500G external HD so I know the data is in there.

  • Get Managed Metadata (Taxonomy) ALL Lists with Columns and ALL Choice Lists with Columns VALUES programmatically

    Hi there,
    How to get Managed Metadata Lists  ALL Columns and ALL Choice Lists Columns that are used in the Site Collection programmatically please.
    Regards

    Hi sharepointaju,
    Managed Metadata list is a hidden list, that you can access it through
    http://siteurl/Lists/TaxonomyHiddenList/AllItems.aspx, then it is similar to other lists, you can use server or client code to interate each field in the list, show the the value for each item.
    For all choice list columns, I'm not clear what you mean in this situation, do you mean to get all choice columns in the site collection, if so, iterate site columns, and lists to get list fields, check whether it is a choice type field.
    This may be not your requirement, please provide more information how you want to get which value.
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Problem with exporting and printing from pages to PDF

    I have a problem with my Pages
    My font will not be embeded in my pdf files.
    I have saved as a ps file and in to the destiller and my fonts are missing.
    I need to send my file to the print shop but they will not accept my file and i now understand why.
    fonts are missing...
    Is there a workaround.
    I have no problem in Indesign or quark but pages.....
    I need help
    thanks a zillion

    The font is coming from a notation software Sibelius 4 and is namned opus
    Hmmm ... Sibelius is a music notation software and notations are marked up in MusicXML. Presumably the font file is an SFNT with TrueType splines, but it is probably not installed in OS X system folders - rather in an internal Sibelius application font folder. So presumably you do not see the font in FontBook and OS X font auditing does not apply to the font.
    Sibelius exports EPS files, right? If memory serves, an EPS is still legal even if the font resource is not embedded. And in any case, we know from the behaviour that the font resource is not embedded for some reason. So how do you get Sibelius to put the font resource inside the graphic ... normally there is a button in the EPS export procedure that gives you the option to Embed All Fonts.
    You do not seem to get this button, though. Or why else would you not have checked it already and the problem would have gone away already.
    The next point in troubleshooting this is that you are not following the path that would let OS X detect that an external font resource is not embedded.
    I go from pages-print-printer- acrobat Pro 8-save as Pdf-x
    What you are doing here is telling Pages to tell OS X to generate a PostScript program within which is nested your Encapsulated PostScript program with the call to an unresolved external font resource.
    So why does Acrobat Pro not detect the unresolved external font resource? Hmm ... did you try the Preflight option in Acrobat 8 Pro? It should provide information on unresolved embeddings.
    I have also tried pages-print-printer- acrobat Pro 8 and save pdf as postscript and put the postscript file in destiller 8 pro with defalt setting high quality print
    The whole problem with EPS and PS is that this sort of situation is possible in the first place (plus, what is worse, the PS program can include custom additions to the graphics model that then fail in the PS interpreter whence Apple GX normalizing, Adobe Distiller normalizing, and Apple Quartz normalizing). You want to get as far away from EPS and PS as possible, believe me.
    So, you have not done what I posted that you should do in the first place. If I were you, I would first get rid of the problem that the EPS is making a call to an external font and then get rid of the problem that the PostScript is preserving the external call.
    To get rid of the problem that the EPS is preserving an external call, simply open the EPS in Apple Preview which includes a NORMALIZER for EPS/PS, and then save out the graphic as PDF. Alternatively, if you don't trust Quartz for some reason, set up a hotfolder for Distiller, make sure the option to embed all fonts is enabled, and convert the EPS to PDF.
    Now replace your EPS in Pages with PDF in Pages, and don't save PostScript to disk but save PDF to disk through the proper procedure which is File > Print > PDF > Save as PDF/X [for your custom configuration of the PDF/X-3 filter considering that no sane person in North Europe prints lowend US SWOP, we use ISO].
    If you begin by telling OS X that you want PDF within which fonts are supposed to be embedded ALWAYS, then you have started the right way. Otherwise, you have not told the operating system what you want to do, and this then leads you into places where you are unlikely to have the expertise to troubleshoot problems.
    So, forget placing EPS in the first place, place PDF. And forget saving PostScript to disk, save PDF to disk. If that does not sort your problem, here is the dirty solution for professional prepress.
    Adobe Photoshop has an EPS rasterizer that has wide tolerances for poor PostScript programming (so does Adobe Illustrator 6 and higher by the way).
    Therefore, if an EPS is posing problems, one workaround is to rasterize the EPS at high resolution in Photoshop and place that high resolution PDF in your layout.
    Take care that you rasterize as 1 bit at the required resolution of the print provider, probably 2450 dpi. When you save the 1 bit as PDF, Photoshop automatically compresses to a very, very small file (don't be surprised if 15Mb compresses to something like 0.5Mb).
    Rasterizing in Photoshop should not be necessary if you simply start by telling the operating system what it is you are trying to do. Then the operating system should be able to take the right decisions for you, and tell if you if finds problems it cannot resolve without turning to you.
    Good luck,
    Henrik
    would-be technical writer

Maybe you are looking for

  • Powermac G3: max 4x256Mbyte. Can you confirm?

    Hi to everybody. I believe the title of the subject is clear but can somebody confirm that the size limit of RAM in each slot is 256Mbyte (machine is produced in july 1999). Does also anybody know if PC-133 256Mbyte DIMM are OK? Thank you very much.

  • Need urgent help. I have been trying to resolve this problem to no avail. I am able to preview my sp

    Need urgent help. I have been trying to resolve this problem to no avail. I am able to preview my sprymenu on my local browsers opera, google crome, and IE but when it is uploaded, the sprymenu squashes to the left hand side.

  • HT201303 why do i keep getting the message "Please contact iTunes support to complete this transaction."?

    why do i keep getting the message "Please contact iTunes support to complete this transaction."? Oh, and I would love to contact support but they are never open for business when this happens to me so I was hoping someone knew what the heck was going

  • RE: ODI READING FLAT FILES

    Hi, I have a file that is produce by Hyperion MAXL and it is not formatted in such a way to read it by ODI. There is no delimited iinformation and it has several junk header and footer lines. I have been resarching and found that I can use Jython or

  • AlwaysOn Failover Scenarios

    Hi, I have implemented AlwaysOn feature between two standalone SQL Server instances hosted on two Clustered nodes in two different subnets (multisite clustering with Node and File Share Majority quorum). I have configured AlwaysOn for automatic failo