How to get higher and second higher value in one row?

Hello world,
I want to get higher and second higher sal from emp in one row ,,
Thanks

  1  select e.empno, e.ename,  e.sal,  lag(sal) over (order by sal) next_sal    from emp e
  2* order by sal
SQL> /
     EMPNO ENAME             SAL   NEXT_SAL
      7369 SMITH             800
      7900 JAMES             950        800
      7876 ADAMS            1100        950
      7521 WARD             1250       1100
      7654 MARTIN           1250       1250
      7934 MILLER           1300       1250
      7844 TURNER           1500       1300
      7499 ALLEN            1600       1500
      7782 CLARK            2450       1600
      7698 BLAKE            2850       2450
      7566 JONES            2975       2850
     EMPNO ENAME             SAL   NEXT_SAL
      7788 SCOTT            3000       2975
      7902 FORD             3000       3000
      7839 KING             5000       3000

Similar Messages

  • ALV GRID: How to change Subtotal and Main total values in standard row

    Hi Experts,
    By using SORT-SUBTOT = 'X' and  FIELDCATALOG-DO_SUM    = 'X', I will get subtotal and Main total.
    My requiremnt is I need be calculate values manually and pass the calculated values to subtotal and maintotal.
    is it possible in ALV GRID?
    By adding extra row we will do this but I am looking standard subtotal and maintotal row change.
    Thanks in advance,
    Mahe

    Hi,
    With function REUSE_ALV_GRID_DISPLAY you cannot do this.
    It´s possible if you create a class inherited from cl_gui_alv_grid and rewrite the method set_data_table, you can do this. Like:
    CLASS xgrid DEFINITION INHERITING FROM cl_gui_alv_grid.
      PROTECTED SECTION.
        METHODS: set_data_table REDEFINITION.
    ENDCLASS.                    "xgrid DEFINITION
    CLASS xgrid IMPLEMENTATION.
      METHOD set_data_table.
    * ....MODIFY data_table ...
        CALL METHOD super->set_data_table
          CHANGING
            data_table = data_table.
      ENDMETHOD.                    "set_data_table
    ENDCLASS.                    "xgrid IMPLEMENTATION
    DATA:    grid  TYPE REF TO xgrid.
      CREATE OBJECT custom_container EXPORTING container_name = mycontainer.
      CREATE OBJECT grid  EXPORTING i_parent = custom_container.
      CALL METHOD grid1->set_table_for_first_display ...
    Best regards,
    Leandro Mengue

  • How to Get ZERO and Non-ZERO Values in rowcount using Group by?

    Dear All,
    How can I get Non-ZERO and ZERO row count values in SQL using Group by? I can get non-zero values but when I want NULL should be returned to non-zero values it is ignoring ZERO values in output?
    Any hint?
    Thanks
    GQ

    Hi,
    Something like
    select count(case col
                    when 0
                    then 1
                  end) zero_count,
           count(case nvl(col,1)
                    when 0
                    then null
                    else 1
                  end) nonzero_countRegards
    Peter

  • How to get the index of selected values in SelectManyChoice...

    How to get the index of selected values in SelectManyChoice... the value which i get is coming when i submit the value second time

    By using the given code i get the value of the selected indices, but problem here is i get the value when it get submits at the second time... First time the length of that int array is 0.
    Second time it shows the value two times (i.e) First time submitted value and the second time submitted value. After that it works fine.. I have problem while clicking first time only..
    The Following error also raises.. One multiselect is dependent on other multiselect.
    DF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase PROCESS_VALIDATIONS 3
    java.lang.ArrayIndexOutOfBoundsException: 6
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.findObjectFromIndex(FacesCtrlListBinding.java:334)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.getInputValue(FacesCtrlListBinding.java:199)
         at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGet(JUCtrlValueBinding.java:2416)
         at oracle.jbo.uicli.binding.JUCtrlListBinding.internalGet(JUCtrlListBinding.java:3717)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.internalGet(FacesCtrlListBinding.java:500)
         at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
         at javax.el.MapELResolver.getValue(MapELResolver.java:164)
         at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
         at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
         at com.sun.el.parser.AstValue.getValue(Unknown Source)
         at com.sun.el.ValueExpressionImpl.getValue(Unknown Source)

  • How to get the latest credit limit values per each customer in the report.

    Hi All,
    Can anybody give me an idea on how to get the latest credit limit values per each customer in the report.
    I have below requiremnt.
    I have cube which is having transactional data on document and customer level .and it also having master data info object in the cube which is credit management view having all the customer numbers .
    This credit management view is master data info object having credit limit key figure as attribute.These credit limit are per each customer.
    So we need these credit limits in the report as dynamic values .(I mean whatever be the current credit limit in the master data table for that paricular customer that should show up in the reporting).
    one more thing these credit limits should roll up correctly at the HTR level.
    One HTR having number of customers .
    for example HTR 100 can have customer number 200,300,400.
    Those 200,300,400 customer credit limits should roolup correctly at the HTR 100 level.
    Example below :
    Cube DATA :
    HTR Customer Doct number Credit managment view
    100 200 10001 200
    100 200 10002 200
    100 300 10004 300
    100 300 10005 300
    100 400 10006 400
    100 400 10007 400
    100 400 10008 400
    Master data tabel (P Table)(Credit managment view)
    Credit managment view Credit limits
    200 1000.00
    300 50000.00
    400 90000.00
    Please remeber :
    We can not make these credit limits as navigational becasue these are keyfigure attributes not characteristics.
    one more thing we can not make them as charatistics because we need use these credit limits to derive other calkculation. so it is not possibel to derive calculations on charactristics .

    Create a formula variable of type replacement path with reference as attibutes of Credit management view and choose your key figure credit limit,say zcredit.
    Now create a formula or CKF and use zcredit.
    This should display the credit limit in your report as normal key figure.
    I didnot get this part "one more thing these credit limits should roll up correctly at the HTR level.", may be the above will solve this too.Try it.
    Hope this helps.

  • Which table i can get BED and ECS+SHEC values

    Hi all
    which table i can get BED and ECS+SHEC values and how i link to PO number..
    plz help me
    thanks
    ramesh

    Hi
    please search before you post the question ,
    this query is discusssed many times in the forum
    [Searching|http://lmgtfy.co/?q=sapexcise%20table]
    for excise check table J_1IEXCHDR for header
    J_1IEXCDTL for item excise

  • How to get the logged in userId value in adf task flow OIM11g R2

    Hi,
    I have created an adf task flow. Now I want to run some query in that based on the logged in userId.
    Could you please help me in knowing how to get the logged in userID value in adf TaskFlow so that I can run a parameterized query.
    Thanks

    3 different ways to retrieve the username (not sure what you mean by user ID) :
    http://mahmoudoracle.blogspot.be/2012/06/adf-get-current-logged-user-name.html#.USI_c-h8zIo
    Also provide your JDev version.
    Basicly, you should use the groovy expression in a view criteria (it's the fastest and easiest way) and call that view criteria whenever you need it.
    That's if you are using ADF BC of course.

  • How to get userId and ResponsibilityId of EBS Application

    Hi all,
    We are using oracle.apps.fnd package to get the userId and ResponsibilityId of EBS Application. By using this api we are getting -1 for both userId and resposibilityId, but want the corrrect values for these two Ids.
    Can anyone please tell us how to get userId and ResponsibilityId of EBS Application using oracle.apps.fnd package?
    Thanks,
    Eswari

    Hi Kumar,
    Thanks for your answer. I tried using pageContext, but it didn't work.
    I forgot to mention the version of EBS Application. We are using 12i.
    To use FND_GLOBAL package first we should initialise by passing userId and respId which we want. Can we get these details from this api oracle.apps.fnd of 12i Instance.
    Thanks,
    Eswari
    Edited by: user593578 on Jul 31, 2009 4:35 PM
    Edited by: user593578 on Jul 31, 2009 5:18 PM

  • How to retrieve start and end date values from sharepoint 2013

    Hi,
    How to retrieve start and end date values from new event form of calendar in SharePoint foundation2013
    Thanks
    Gowri Balaguru

    Hi Srini
    Yes i need to have parallel flow for both and in the cube where my reporting will be on monthly basis i need to read these 2 master data and get the required attributes ( considering last/first day of that month as per the requirement).......but i am just wondering this is common scenario....while there are so many threads written for populating 0employee from 0person......don't they have such requirement.....
    Thanks
    Tripple k

  • How to get the object class field value in CDHDR table for vendor

    hi
    how to get the object class field value in CDHDR table for vendor

    Try KRED/KRED_N as object class in CDHDR for Vendor.

  • How to get gui_download and gui_upload with popup filename?

    how to get gui_download and gui_upload with popup filename?

    Here is a short example.
    report zrich_0003 .
    data: ifiletab type filetable.
    data: xfiletab like line of ifiletab.
    data: xstring type string.
    data: rc type i.
    data: itab type table of string.
    data: xtab type string.
    start-of-selection.
      call method cl_gui_frontend_services=>file_open_dialog
        changing
          file_table              = ifiletab
          rc                      = rc.
      read table ifiletab into xfiletab index 1.
      xstring = xfiletab-filename.
      check not xstring is initial.
      call method cl_gui_frontend_services=>gui_upload
        exporting
          filename                = xstring
      changing
        data_tab                = itab.
      loop at itab into xtab.
        write:/ xtab.
      endloop.
    Regards,
    Rich Heilman

  • How to get nodes and its attributes of an XML file usiong DOM parsing?

    how to get nodes and its attributes of an XML file usiong DOM parsing?
    i am new to XML parsing.......
    Thanking you........

    import org.w3c.dom.Document;
    import org.w3c.dom.*;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.DocumentBuilder;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;      ...
    //Setup the document
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
         Document doc = docBuilder.parse (new File("MY_XML_FILE.xml"));
    //get elemets by name
         String elementValue = doc.getElementsByTagName("MY_ELEMENT").item(0).getTextContent();
    //This method can return multiple nodes, in this instance I get item(0) , first nodeRead the api for other methods of getting data.

  • How to get vendor and company code based on logistic invoice document

    how to get vendor and company code based on logistic invoice document in abap/4?

    Hello Kumar
    When you call BAPI_INCOMINGINVOICE_GETDETAIL using
    INVOICENUMBER = <number of invoice>
    FISCALYEAR = <fiscal year>
    the returned HEADERDATA contains what you are looking for:
    HEADERDATA-COMP_CODE
    HEADERDATA-DIFF_INF
    Regards
      Uwe

  • How can i copy and referencing the value of a sub-total of a category into another cell?

    How can i copy and referencing the value of a sub-total of a category into another cell?

    Cells in Category  rows 'exist' only when those categories are inserted using the Reorganize table. Those cells cannot be referenced from other cells.
    If you want a category summed, you will need to do that in a cell that is still visible when the table is not sorted into categorie using the Reorganize pane. The function to use is SUMIF. You can find information regarding SUMIF (and SUMIFS) in the iWork Formulas and Functions User Gude. The guide may be downloaded using the link in the Help menu in Numbers '09.
    Regards,
    Barry

  • How to get tools and other bars back in view after deleting show-bar?

    How to get tools and other bars back in view after deleting show-bar?

    Hello Jouko.
    You can go into View > Toolbars and select the ones you want to see. If you can't see the menu bar you can simply tab ALT on your keyboard (I think F10 works too) to show it.

Maybe you are looking for

  • Macbook Pro connected to HDTV full screen problem

    I connected my Macbook Pro to my TV via HDMI. When i have an application on the TV (safari) and press the full screen button (upper right corner with the 2 arrows) my Macbbok display shows this grey area. If fulscreen an application on the Macbbok di

  • Full Screen display swap

    Hey there Is there any way to swap the dsiplay arrangement when using 2 monitors with speedgrade? Am I missing something very basic? Thanks

  • Why are parameters to startElement() empty in SAX handler?

    I extended the SAX DefaultHandler in the standard JAXP download. The startElement() method has 4 parameters, but only the third one gets any values. Even with the tag shown below, the URI parameter is always blank as is the local name parameter. The

  • Pass server exceptions to client in AXIS

    Hi everbody! I have a working Apache Axis framework and want to pass the exceptions thrown on server-side to the client. For instance I get an SQL-Exception on server side that the database wasn't found. (this problem was of course caused intentional

  • VIA C7 and Arch

    Hello! I've bought a VIA motherboard with a C7 processor to work as NAS. Does Arch work on this type of CPU? I don't think so, but, just to know. At least, my laptop have arch :-) Bye!