The values just don't not properly using a case in a query

Hello PL/SQL gurus and experts.

I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version

I'll have the data in the table below-
drop table stud_fact;
create table stud_fact(stud_NM, LVL_CD,ST_DT_DIM_KEY,OVRNK) as select
'ABG Sundal','H','20110630','175' from dual union all select
'ABG Sundal','H','20120630','0' from dual union all select
'ABG Sundal','Y','20111231','147' from dual union all select
'ACF Intl','H','20110630','280' from dual union all select
'ACF Intl','H','20120630','0' from dual union all select
'ACF Intl','Y','20111231','418' from dual union all select
'AK Invest','H','20110630','485' from dual union all select
'ANZ','H','20120630','0' from dual union all select
'Arbor','H','20110630','12' from dual union all select     
'Arbor','H','20120630','21' from dual union all select
'Arbor','Y','20111231','5' from dual ;
I use the following sql to retrieve the output-

Select stud_nm,
(case when ST_DT_DIM_KEY ' 20110101 ', ' 20111231' and LVL_CD = 'Y' then OVRNK)
on the other case when ST_DT_DIM_KEY ' 20110101 ', ' 20110631' and LVL_CD = 'H' then OVRNK
ELSE ' 0'
END
END YRRK),
(case when ST_DT_DIM_KEY ' 20120101 ', ' 20120631' and LVL_CD = 'H' then OVRNK)
ELSE ' 0'
LYRK END)
OF stud_fact

but it gives the output as.
RPT_BRKR_N YRR
---------- ---
ABG Sundal 175
ABG Sundal 0
ABG Sundal 147
ACF Intl   280
ACF Intl   0
ACF Intl   418
AK Invest  485
ANZ        0
Arbor      0
Arbor      0
Arbor      0
I expect the output to be-
stud_nm          yrrk     lyrk
ABG Sundal     0     147
ACF Intl     0     418
AK Invest     0     485
ANZ          0     0     
Arbor          21     5
select stud_nm,
         max(case when st_dt_dim_key between '20120101' and '20121231' then ovrnk
                                 else '0' end)
                      keep (dense_rank first
                            order by
                            case when st_dt_dim_key between '20120101' and '20121231' then 0
                                 else 1 end,
                            lvl_cd desc) yrrk,
         max(case when st_dt_dim_key between '20110101' and '20111231' then ovrnk
                                 else '0' end)
                      keep (dense_rank first
                            order by
                            case when st_dt_dim_key between '20110101' and '20111231' then 0
                                 else 1 end,
                            lvl_cd desc) lrrk
from  stud_fact s
where st_dt_dim_key between '20110101' and '20121231'
group by stud_nm
order by stud_nm
  ;

STUD_NM    YRRK LRRK
---------- ---- ----
ABG Sundal 0    147
ACF Intl   0    418
AK Invest  0    485
ANZ        0    0
Arbor      21   5  

Hope the rank column is NUMBER. You need to make changes accordingly...

Tags: Database

Similar Questions

  • "Could not perform this operation because the default mail client is not properly installed" when you use Windows Mail

    Original title: loss of entrance of Protocol in the list of saved files

    I use an old Toshiba laptop of two year with Vista as an operating system. It came with a trial version of Microsoft Office already installed. I had no use for it then after the trial expires I uninstalled. This seems to have created a minor problem with the e-mail program. When I visit a Web site and click on 'Contact us' I get an error message as follows "cannot perform this operation because the default mail client is not properly installed." I suspect strongly as during the uninstallation of office he removed a protocol in the list entry, similarly, the bottom of the list of the saved files. A check with other similar computers with Vista installed seems to confirm this. If someone at - it a quick fix to this problem? I don't want to resort to installing a whole new email software to fix this minor problem if I can avoid it.

    Hello Karena R, yesterday, I downloaded and installed Windows Live Mail, and I must say that I prefer Windows Mail Live Mail program. After making sure that Live Mail is the deafult for all messaging functions and that the entry "Mail Protocol" was now back to the list of saved files, I checked the problem mentioned in my original post. He is not fixed! Another small problem is fixed now if. In my "drafts" mailbox I have some e-mails stored there and when I click on one of them upwards now comes an email with the appropriate address inserted in the address line. Who could not before. I used to get this error message, which is now the new title of my post. So why the difference when I click on email address that I find on Web sites? Now, I also find that by Michael following the instructions (below), I do not see an entry "mailto" but his suggestion to step d. type in "URL Protocol" is not appropriate because it is already there. The installation of an entirely new email software should have my computer all the necessary entries for the new program to function properly in all respects. So what's happening? It begins to look as if uninstalling the program Office has pulled something real Vista operating system.

    It's a good thing, I thought of the research on other boards for my missing post.

    HKEY_LOCAL_MACHINE\Software\Classes\mailto

    c. in the Edit menu, select new, then clickstring goodwill.

    d. type of Protocol of URL as the name of the new string value

    e. exit the registry editor

  • Set the values in cascade LOV (Skillbuilders SuperLOV used)

    Hello

    I install a simple page with a SuperLOV cascading.

    I'm trying to set the values of the first and the second SuperLOV based on the selection of a report.

    After the selection, a javascript function is called that sets the variable state and browser session P1_EMPNO

    function editRecord(pValue) {
       //set session state of P1_EMPNO to use in pl/sql query
       var a=new htmldb_Get();
       a.add('P1_EMPNO', pValue);
       var r=a.get();
    
       //set variable to trigger dynamic action
       $s('P1_EMPNO',pValue);
    }
    

    I use this point (P1_ITEM) to trigger a dynamic Action (when the value changes AND is not null) to SET the VALUE for the first LOV. This method works.

    Then one created a second dynamic Action that uses the event AFTER REFRESH for the first LOV to SET the VALUE for the second SuperLOV. It does not work

    Just to test the logic, I created a third standard LOV which is the same as the second SuperLOV and respective dynamic action. This one works.

    It's the http://apex.oracle.com/pls/apex/f?p=49044:1 application

    (PATRICK, demoadmin, 1234) application WORDERS.

    I would be very grateful for any help

    Thank you.

    OK, I discovered what was going on.

    I used a $('#P1_EMP').apex_super_lov of javascript for dynamic Action action to set the value of the SuperLOV.

  • Message: Cannot perform this operation because the default mail client is not properly installed

    I get the following error message:

    Cannot perform this operation because the default mail client is not properly installed

    Could someone help me please?

    Moved from the community involvement Center

    Hello

    You have a common problem of Windows 7. You must set a default e-mail program and Windows 7 did not come with a pre-installed email program.

    The default e-mail program must be installed on the computer - for example Windows Mail (Vista), Windows Live Mail, Thunderbird, etc.

    Windows Live Mail is popular
    http://Windows.Microsoft.com/en-us/Windows-Live/Essentials
    Is Thunderbird http://www.mozilla.org/en-US/thunderbird/

    Windows Essentials help:
    http://Windows.Microsoft.com/en-us/Windows-Live/Windows-essentials-help

    You can access outlook.com via Windows Live Mail

    Set up an email application with Outlook.com - Microsoft Windows Help:
    http://Windows.Microsoft.com/en-us/Windows/Outlook/send-receive-from-app

    After installing an e-mail program, make sure you have a default e-mail together program control panel > Default programs > set access and computer program defaults > Custom > click on the arrow down.

    Web-based e-mail services can only be made the default e-mail program in these 2 cases:
    * Yahoo, with the Yahoo tool bar
    http://help.Yahoo.com/l/us/Yahoo/mail/YAHOOMAIL/settings/settings-10.html
    * Gmail with the installed Google toolbar

    https://support.Google.com/toolbar/answer/34800?hl=en

    Don

  • Cannot perform this operation because the default mail client is not properly installed... help

    I can't send an e-mail from a link on a page without getting this error... "could not perform this operation because the default mail client is not properly installed"...    My windows mail is set as default and I can receive and send him good, please help.

    Thank you

    A program is defined as default does not mean that it has considered all of the default roles available.  In the case of Outlook 2007, there are 13 total default values that can be assigned, and it should have each of them.  It is possible to default Outlook for e-mail, but not the default value for write links in web pages.

    HAL

    --
    HAL Hostetler, TCE
    Engineer senior/UPDATED--MS MVP-Print/Imaging - WA7BGX
    www.kvoa.com - KVOA television, Tucson, AZ.
    Live Hot Licks - www.badnewsbluesband.com
  • Download "the default mail client is not properly installed" when I press a button on the site for email.

    Original title: default mail Client

    Sometimes a website has a button to send no given address. When I hit the button I get the message "the default mail client is not properly installed".  What does that mean? I do not see in any Windows mail information page.

    Saturday, September 27, 2014 00:43:08 + 0000, larry3000 wrote:

    Sometimes a website has a button to send no given address. When I hit the button I get the message "the default mail client is not properly installed".  What does that mean? I do not see in any Windows mail information page.

    Are you doing your e-mail on a web site? If so, you probably haven't
    set up a default email client. The e-mail client is the program
    you use for mail, not a website. Standard e-mail programs are
    Outlook.exe, Windows Live Mail, Thunderbird, strong Agent, etc. He
    are a lot of choices.

  • The listener is down: even if a listener with the name "AUDITOR", is running on this host at the port: "1521", it has not started using "the target LISTENER. ORA file.


    I moved a listener on a host in a House different oracle. The headset works fine, but EM 12 c shows that the listener is down with the following summary:

    The listener is down: even if a listener with the name "AUDITOR", is running on this host at the port: "1521", it has not started using "the target LISTENER. ORA file. CORRECTIVE ACTION: To monitor this "EM listener target" with its current configuration, you must stop the process of listening running and start it using the Listener parameter file: opt/oracle/product/12.1.0.2/network/admin/listener.ora. Alternatively, you can update "this target LISTENER. Location ORA setting"with the location of the listener running, which started using the: opt/oracle/product/11.2.0.3/network/admin/listener.ora.

    EM 11 g, I simply changed the configuration of the listener for the different oracle home, argued the change and in a few minutes the listener would show that 'UP' with the oracle of new home. I upgraded to MS 12 c (12.1.0.4) and can't find how to do this. Can someone give me the procedure.

    Thank you

    Ron

    Hi Ron,

    Can you please do the following?

    -Create a for the listener listener.ora file, stop and start the receiver using the listener.ora file. If the file is located in a default location, set the TNS_ADMIN environment variable to that location before you start the listener.

    -Log on to the EM console, go to the homepage of the listener.

    -In the Oracle Listener menu, select target Configuration > Configuration of the analysis.

    -Ensure that the parameters, including the Listener.ora directory, are properly.

    Kind regards

    -Loc

  • Change the value (current line) of multicolumn listbox using the mouse

    Salvation is a way to change the value (current line) of multicolumn listbox using the mouse?

    Here's a way to do it.

  • I get a message "Cannot perform this operation because the default mail client is not properly installed". What should I do?

    I get a message "Cannot perform this operation because the default mail client is not properly installed".  What should I do?

    Unlike Windows XP & Vista, Win7 does not have a default email Client. [What were thinking?]

    You will need to install a (e.g. MS Outlook;) Windows Live Mail; Thunderbird) , and then set it as a default for mail in CUSTOM (<>) article in Set Program Access and defaults of the computer , then restart your computer before any function send to or MailTo will become available.

    In this forum, you will find some support for Outlook: http://answers.microsoft.com/en-us/office/forum/outlook

    Note: Office 2010 Home and Student Edition is not include Outlook.

  • Windows activation error - 0 x 00000279. the sepecified product key could not be used

    activation of the window, instantly need product key to activate my str. window 7 pc but, why I get the error of activation code 0 x 00000279. the sepecified product key could not be used after the second time I try to reinstall windows 7 str...?

    Click Start, type: CMD

    Right-click on CMD

    Click on run as administrator

    At the command prompt, type the following commands:

    slmgr.vbs - ipk xxxx-xxxx-xxxx-xxxx (to replace the specified in the current product key)

    xxxx-xxxx-xxxx-xxxx - represents your product key

    Press enter on your keyboard

    Leave the command prompt

    Restart your computer

    Try again activate by phone:

    How to activate Windows 7 manually (activate by phone)
     
    1) click Start and in the search for box type: slui.exe 4
     
    (2) press the ENTER"" key.
     
    (3) select your "country" in the list.
     
    (4) choose the option "activate phone".
     
    (5) stay on the phone (do not select/press all options) and wait for a person to help you with the activation.
     
    (6) explain your problem clearly to the support person.
     
    http://support.Microsoft.com/kb/950929/en-us
    ----------------------

  • Not properly used by the printer cartridges

    Original title - printer

    I have a HP 2610 printer all-in-one. If I print a test page, it uses two cartridges, color and black. If I try to copy or print; either the printer or the computer, it will use only the color cartridge and will not use the black cartridge. I tried cleaning the printer. Remove and then reinstall. I don't know what to try next.

    Hello

    As OEM HP is responsible for the good operation of the printer and their
    drivers provided. Check with HP support, their documentation online and
    drivers and ask in their forums.

    Try printing HP and Scan Doctor for Windows
    http://h10025.www1.HP.com/ewfrf/wc/document?cc=us&LC=en&DLC=en&docName=c03286146

    Good luck, you need to update or reinstall the latest driver.

    HP support/troubleshooting & drivers
    http://welcome.HP.com/country/us/en/support.html

    Contact HP
    http://welcome.HP.com/country/us/en/contact_us.html

    HP forums
    http://h30434.www3.HP.com/PSG/

    =============================================

    The main issue is probably the drivers, but these can help:

    Add or remove a printer
    http://Windows.Microsoft.com/en-us/Windows-Vista/add-or-remove-a-printer

    Solve printer problems (Vista)
    http://Windows.Microsoft.com/en-us/Windows/printer-problems-in-Windows-help#fix-printer-problems=Windows-Vista&V1H=win8tab1&V2H=win7tab1&V3H=winvistatab1&v4h=winxptab1

    Solve printer problems (Vista)
    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-printer-problems

    Solve printer problems (Windows 7)
    http://Windows.Microsoft.com/en-us/Windows/printer-problems-in-Windows-help#fix-printer-problems=Windows-7&V1H=win8tab1&V2H=win7tab1&V3H=winvistatab1&v4h=winxptab1

    Open the printer (Windows 7) Troubleshooter
    http://Windows.Microsoft.com/en-us/Windows7/open-the-printer-Troubleshooter

    Find the manufacturer's Web site
    http://Windows.Microsoft.com/en-us/Windows-Vista/find-a-printer-manufacturers-website

    Find and install printer drivers in Windows 7
    http://Windows.Microsoft.com/en-us/Windows7/find-and-install-printer-drivers

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • using script to get the values of percentage and not able to sum up to 100%

    Hi all

    I am trying to use a parseFloat() function to convert the string value as a percentage, and then try to add all the values of %.

    but for a few scenrios even if the amount is 100% of the service I get the PctValue be <>100.00%

    the calculation of the function is as follows: -.

    code-

    {iterating_through_all_the_fields}

    PctValue += parseFloat (this.getField("Percentage1").valueAsString);

    }

    sample-

    11.12

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    11.11

    amount is 100

    but through code mentioned above I return 99.99

    Any help is appreciated in this regard.

    It is a result using the floating point IEEE standard and conversion from decimal to binary values values. We need to round up all the calculations of money or mils will accumulate and cause errors. For percentages, it is better to round up receipts and total final eliminate the accumulation of amounts below the figure the least significant.

    It is possible to use the util.printf of rounding.

    The following script will show what is happening:

    function Round (nValue, nDec) {}
    If (typeof nDec == "undefined") nDec = 0;
    Return number (util.printf ('%, 1 0. nDec + "f", Number (nValue)));
    }

    var nValues = new Array (11.12 11.11 11.11, 11.11, 11.11, 11.11, 11.11, 11.11, 11.11);
    nSum var = 0;
    for (var i = 0; i)< nvalues.length;="" i++="" )="">
    nSum = nSum + Round (nValues [i], 2);
    Console.println (i + "" + nValues [i] + "" + nSum);
    }
    Console.println (nSum);
    nSum = Round (nSum, 2);
    Console.println (nSum);

    Progression of the sum at each stage.
    0 11,12 11.12
    1 11.11 22.229999999999997
    2 11.11 33.339999999999996
    3 11.11 44.449999999999996
    4 11.11 55.559999999999995
    5 11.11 66.66999999999999
    6 11.11 77.77999999999999
    7 11.11 88.88999999999999
    8 11.11 99.99999999999999
    99.99999999999999
    100

    true

    It's a good idea to use decimal values a percentage and leave the determination of the field format display and the borough. But for applications of the sum, the user can round up the value of the actual field and not only display.

  • Just installed 4.0 (using IE). Firefox orange tutorial by clicking on the button in the upper left corner of the screen, but I did not. Using Windows XP

    I check the toolbars are displayed and the Navigation Menu and bookmarks toolbars are checked to display. I uninstalled and reinstalled but still no firefox button on my screen.

    The orange Firefox button is not the default on Windows XP, because it is in Vista and Win7. Right-click on the Menu bar and click on the Menu bar to select the option disable.

  • View object: how to get the value of a 'connection variable' by using expression groovy?

    Hi all

    I have a view object, and I set a variable binding for the VO. Then, I want to set the default value of an attribute of the VO to the variable binding.
    I try to set the Type of object to the Expression attribute value and the value in the name of the connection variable. But it does not work.

    My question is how to use a bind variable in groovy script?

    Thanks in advance and sorry for my bad English.
    Samson Fu

    Hi Samson,.

    Try this:
    viewObject.getNamedWhereClauseParam ("Your_Bind_Variable_Name")

    Note: Keep the viewObject is, don't replace with your name viewobject

    Jean Lou

  • How to change the value of string clustered, to implement using the node value of property instead of writing directly on the flow of data or using the variable

    new to labview :-) and I have a problem when I want to change the value of a string in bunches, and I want to implement this using the node value of property instead of writing directly to the stream or by using the variable, enclosed is the picture.   No matter, I have change in cluster (control) or value of Popery out (indicator) cluster, the value (sensor 7) dataflow keeps unchanged even I gave the new value by value of property node. Thank you to give me some advice about this.

    Hi GerdW

    Thanks a lot for your answer. The reason I'm stubbornly tring to break the flow of DATA is: we have a test system that have about 100 screws, they have a few connected flow, some of them will be unbundling a cluster dataflow chain to check the value in order to make the different cases.  Now I want to insert user event by changing the control and influential cases during run time.

    As I initially uses a global variable (to control cases) instead of unbundle string data flow, it works well.  But then, I found there are a lot of screws that are using the string unbundle.  One of the 'lazy' means, I tried is to change the value via the property node (because that way, I did not need to find all the places where using the unbundle string and replace them with the global variable), then I noticed a problem with "dataflow", the value in the stream of cluster in fact will not be changed by changing the value of the property node.

    I did a test with VI simple (like the picture in last post), and after reading your advice, I tell myself that I need to understand the concept of "DATAFLOW" in labview, it seems that my "lazy" way can not work in this scenario.

    I have attached the criterion VI here, have you furthur suggestions on what I can do in this case?

    Mant thanks!

    Minyi

Maybe you are looking for