Find second Biggest and second smallest values in the table

Hi guys
I am new to oracle - sql and pl/sql
I need u r help
My question is i have a table with columns s.no, emp name, salary etc.,
how can i get the second largest and smallest value in the table (based on salary)
Any one pls give the queries (pls the query is used in oracle 8i)
Regards
Marimuthu.N

You only need to use max and min. Once you have it, select the max lower than max and the min biggest than min.

Similar Messages

  • Oracle Alert: Access before and after update values of a table column

    We have a requirement where a notification needs to be sent when 'END_DATE' attribute (column in a table X) is set, in an Oracle Applications form.
    I have defined an Event based Oracle Alert which fires 'On Update' of the table X.
    Could anyone please let me know as how to access the value of 'END_DATE' before and after update (i.e :new.END_DATE and :old.END_DATE) in the sql query of the alert.
    The need to use the before update and after update values of the attribute 'END_DATE' is that if we add the condition END_DATE is not null, the alert is sent even if any other attrbutes are updated in the Oracle form which is not the intended behavior.
    Appreciate any help.
    Thanks

    Hi
    use selectionlistener for your first table then add clientlistener and serverlistener so that you will get the rows on click in back bean.
    then get second table vo and and create and add row for that view object. add partial target to refresh your second table from back bean.
    on click of save call commit operation.

  • Saving and passing SelectOneChoice Values for af: table population

    Hey yall.
    *First things first... I am using the EJB as opposed to ADF BC so any examples involving VO's would not help me at this point and that's pretty much all I have been able to find online when searching for help.  I am using JDev version 10.1.3.1.
    Im having some trouble trying to figure out how to program my command button to return a table using the values acquired from a set of 3 dynamic LOV's. In detail, this is what I'm trying to do but can't get it to work no matter what I do:
    1. I have a page where the user must select an option from each drop down list (there are 3 in all). The 2nd list depends on the 1st and the 3rd list depends on the 1st and 2nd. That part is working fine.
    2. Once all selections are made, the user must then click on execute (my command button on page) to then be taken to another page with a table populated using the values selected in the previous page. The table was created using a method from the data control palette that contains the named queries needed to return results in the table.
    3. My problem is figuring out how to wire the execute button to do the tasks mention in #2 above.
    Any suggestions? Ideas? Help?
    Greatly appreciative... Thanks.

    Hi,
    you can do this from the UI using createWithParams
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
    Or by overriding the doDML on the parent EO so you can use an association to update the child records. And of course you could use view links similar. However, the update is recognized on the entity level. And finally, another option - if the tables are not loaded together in an application, is to use a database trigger
    Frank

  • DP - Sales and Demand Forecast values in the Planning book were increased.

    Dear DP Experts,
    The Sales and Demand Forecast values in the Planning book were increased.  Is there a way to tract who user could have made the changes?  Can we view the last change like in the document flows?
    Thanks,
    Glason

    hi Glason
    if the values have been changed by the user community, I am not sure if there is a way to find out. However if there is technical flaw in data processing, you can check for the steps as posted in the above post.
    We faced a similar issue in our project. We were not able to trace the user ids under which the values were changed. However since we retain the 15 days of back up, we were able to check that the values were changed on a certain date but not the user ids. but we were still able to restore the original values.
    As an additional step, we also developed macros to store (in the form of alerts) the exisitng value and the updated value incase the there was a manual change in the Sales forecast and other editable key figures.  This ensured that there was a check if there was a manul change. we also ensured that these macros were not executed during the background jobs.
    SAP also provides a standard SAP APO Change Monitor add-on which can be used to track chnages to the key figures. Please refer to note 1308968 for further information on the add on.
    let me know if this helps.
    Rgds, Sandeep

  • Exit in DP90 and how to get value in the table

    Hi all,
    My requirement is when execute DP90(create billing request), the amount in the table must be validated when I click the "Billing Request" button.
    Please tell me the user_exit, BADI or any other enhancement which can I use to validate the amount in that transaction.
    And how to get the amount(amount to be Billed, Amount rejected) value in the table after that??
    Thanx

    Hi Teja,
    Check the BADI (SE18) - BADI_SD_DPBP - Extensions in SD for DP90 with Billing Plan

  • SQL Server 2012 Management Studio: Creating a Database and a dbo Table. Inserting VALUES into the table. How to insert 8 Values for future use in XQuery?

    Hi all,
    In my SQL Server 2012 Management Studio (SSMS2012), I tried to create a Database (MacLochainnsDB) and a dbo Table (marvel). then I wanted insert 8 VALUES into the Table by using the following code:
    USE master
    IF EXISTS
    (SELECT 1
    FROM sys.databases
    WHERE name = 'MacLochlainnsDB')
    DROP DATABASE MacLochlainnsDB
    GO
    CREATE DATABASE MacLochlainnsDB
    GO
    CREATE TABLE [dbo].[marvel] (
    [avenger_name] [char] (30) NULL)
    INSERT INTO marvel
    (avenger_name)
    VALUES
    ('Hulk', 1),
    ('Iron Man', 2),
    ('Black Widow', 3),
    ('Thor', 4),
    ('Captain America', 5),
    ('Hawkeye', 6),
    ('Winter Soldier', 7),
    ('Iron Patriot', 8)
    I got the following error Message:
    Msg 110, Level 15, State 1, Line 5
    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
    How can I correct this problem?
    Please kindly help and advise.
    Thanks in advance,
    Scott Chang
    P. S.
    The reason I tried to create the Database, dbo Table, and then to insert the VALUES is to learn the following thing:
    You can query the entire node tree with the following xquery statement because it looks for the occurrence of any node with the /* search string:
    DECLARE @x xml;
    SET @x = N'<marvel>
    <avenger_name>Captain America</avenger_name>
    </marvel>';
    SELECT @x.query('/*');
    You can query the avenger_name elements from the marvel_xml table with the following syntax:
    SELECT xml_table.query('/marvel/avenger_name')
    FROM marvel_xml;
    It returns the following set of avenger_name elements:
    <avenger_name>Hulk</avenger_name>
    <avenger_name>Iron Man</avenger_name>
    <avenger_name>Black Widow</avenger_name>
    <avenger_name>Thor</avenger_name>
    <avenger_name>Captain America</avenger_name>
    <avenger_name>Hawkeye</avenger_name>
    <avenger_name>Winter Soldier</avenger_name>
    <avenger_name>Iron Patriot</avenger_name>
    You can query the fourth avenger_name element from the marvel_xml table with the following xquery statement:
    SELECT xml_table.query('/marvel[4]/avenger_name')
    FROM marvel_xml;
    It returns the following avenger_name element:
    <avenger_name>Thor</avenger_name>

    Hi Scott,
    The master database records all the system-level information for a SQL Server system, so best practise would be not to create any user-defined
    object within it.
    To change your default database(master by default) of your login to another, follow the next steps so that next time when connected you don't have to use "USE dbname" to switch database.
    Open SQL Server Management Studio
    --> Go to Object explorer(the left panel by default layout)
    --> Extend "Security"
    --> Extend "Logins"
    --> Right click on your login, click "propertites"
    --> Choose the "Default database" at the bottom of the pop-up window.
    --or simply by T-SQL
    Exec sp_defaultdb @loginame='yourLogin', @defdb='youDB'
    Regarding your question, you can reference the below.
    SELECT * FROM master.sys.all_objects where name ='Marvel'
    --OR
    SELECT OBJECT_ID('master.dbo.Marvel') --if non empty result returns, the object exists
    --usually the OBJECT_ID is used if a if statement as below
    IF OBJECT_ID('master.dbo.Marvel') IS NOT NULL
    PRINT ('TABLE EXISTS') --Or some other logic
    What is the sys.all_objects? See
    here.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • HT202213 My apple TV no longer finding my movies and photos. What's the deal with this?

    My apple TV no longer finding my movies and photos. What's the deal with this?

    That would be awesome, if the nearest service area wasn't 4 hours away.... It would cost me just as much in gas to drive down there as it would just to buy a cheap replacement off of ebay...

  • I have iphone 4 and it connect to some wireless networks and some others are not visible while other lphones can find these networks and i tried to restart the phone many times and there is no result, kindly advice

    i have iphone 4 and it connect to some wireless networks and some others are not visible while other lphones can find these networks and i tried to restart the phone many times and there is no result, kindly advice

    Some updates and clarifications:
    1. I already have my 2.4 channel fixed.
    2. Wireless network name is 8 alphanumeric characters; no spaces
    3. Already using WPA2 security with a 10 alphanumeric key (again, no spaces)
    4. I am running Airport Utility 6.0, Mac OS version 10.7.4
    I should also say that these problems started happening less than a month ago...prior to that all devices where working normally.
    An added update: My two e-readers (nook ST and Kindle 3) are also refusing to connect...perhaps confirming that I have 2.4 GHz issues?

  • How to find the value in the table in database ?

    Hi, Could you please advise me, How to findout the data-value in the table in database ?

    what do you mean by value ?
    --Girish                                                                                                                                                                                                                           

  • How to display(binding) values in the table from more than one node?

    Hi,
    I have two nodes (TRIPS & AMOUNTS)in the context. How to bind these values into the table control?
    When i bind second one, first one is getting replaced.

    Hi Mog,
    Of course it is possible to create a table from attributes of more than one node, and in some cases this is still necessary, but you have to do this the hard (manual) way.
    If you have a table control, have a look at the properties and the elements belonging to it.
    First of all, there is the property "dataSource", which binds to a multiple node (let's name it TableRootNode). This means that for each element of THIS node, one row is created. In each row the data of exactly one element of this TableRootNode is displayed.
    Then you have columns in this table. Inside of the columns there is a header and an editor. The editor is the interesting part.
    Normally the primary property of this editor is bound to an attribute of the TableRootNode. Then everything works as expected. If it binds to an attribute of a subnode (SUB) of TableRootNode, then in row i the data of the subnode of the i-th element of TableRootNode is displayed. There is no need for SUB to be a multiple node, but it must not be a singleton.
    If you bind a property of the editor to an attribute, which does not lie in the subtree of TableRootNode, then you will see the same value in each row.
    Now it depends on the structure of your context. Take the node, which is relevant for the change in each row (I assume it is TRIPS) and bind the table to the node as you are used to. Then for each additional column, you have to create a new column in the tree, create a new header element with a title and a new editor (e.g. textview or inputfield) and then bind the right property of the editor to the corresponding attribute in node AMOUNTS).
    If these 2 nodes do not have parent-child-relationship, the tip to create a new node, which consists of the attributes of both nodes is the only solution.
    Ciao, Regina

  • How to display the values from the table in the screen

    Hi,
    I have created a screen where i will enter the values for the field treshold amount and desc and if i press update button  .it will update the new values by overriting the existing values .
    Now i have got requirement i need to create a button show which will display the existing value from the table. always there will be only one entry...in this table
    Please can one give me idea...to do this
    or sample code...thanks in advance
    regards
    paveeeeee

    Define a function code 'SHOW' for your button. In your PAI module, when you check for various sy-ucomms, check for 'SHOW' also.
    Your code will be like this:
    Case sy-ucomm.
      when 'SHOW'.
         perform show_details.
    endcase.
    In the perform, you can fetch the data from the table and put it in global variables. In the PBO, move the data from the global variables to the screen fields so that they get displayed on the screen.
    Hope this helps. Reward points for useful answers.
    Regards
    Nithya

  • Old value in the table  SETLEAF

    Dear All,
    Normally we take back up on every weekend. Due to some wrong transport request in production in last weekend, all the value in the table - SETLEAF has been overwriten. Is there any way in which we can read the value entry in the table -SETLEAF from the back up system befor the last week end ?
    Please help immideate basis.
    Regards,
    sp sahu

    Hello,
    I think you will have to build another database to read the value from specific table.
    Restore system to another server and check the table valaues.
    Good Luck,
    Atil

  • How to Maintain Values in the Table control?

    Hi,
    I'm Saikumar.
    I've done a table control program.
    When I click SAVE or ENTER Button, the values are getting saved into the database(This is working alright)......but when I click those buttons, The values entered in the table control are getting cleared.
    What should I do in order to have those values in the table control itself when I click SAVE/ENTER? (I need to create multiple records at a time)
    What I've done is:
    IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
    INSERT into <database table> values wa_matgl.
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    Refresh it_matgl.
    endif.
    I tried many ways but the vales are getting cleared in the table control? (I need to create multiple records at a time).
    Please suggest a way to overcome it.
    Thanks in advance,
    saikumar

    Hi ...
    Just to add...
    were there any values in the internal table it_matgl  initially in the PBO screen to be shown to the users ?
    <u>if the answer is no...then......</u>
    i came across the same coding in DEMO_DYNPRO_TABCONT_LOOP_AT.....
    here also in PAI..when we press enter..the values are not retained...
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    <b>because i believe the modify statement is not working.coz the it_matgl is empty..pls check if sy-subrc = 0....after the modify statement....if it is not...then we need to insert the data into the it_matgl using an append statement</b>
    for this it_matgl needs to be with header line...
    Pls explore the following....
    data : it_matgl type table of XXXX with header line.
    in the section
    IF sy-ucomm = 'SAVE' OR sy-ucomm = 'ENTR'.
    INSERT into <database table> values wa_matgl.
    MODIFY it_matgl from wa_matgl INDEX tc1-current_line. "tc1 is the table control name.
    <i>if sy-subrc <> 0.
    move corresponding wa_matgl to it_matgl.
    append it_matgl.
    clear it_matgl.
    endif.
    endif.</i>
    Pls check and revert
    Regards
    Byju

  • How to update values in the table control at  Cat2 transaction,

    Hi,
    i am working on cat2 transaction, here
    i am using the exit_saplcats_006 and updating values at catsdb table, but i want to display this values at the table control in the cat2 transaction.
       can any one provide me solution for this same.
    Regards

    Hi Suresh
      this is actual requirement
    in the CAT2.
    1. Add a new column for WBS description and derive the value as per the FS
    2. Retrieve project number and description and update in the column specified
    3. When a service order is selected it should do the same for 2.
    4. Finally repeat for the worklist view (which is the section above)
       here i am able to display values at data entry area
    for service order and network but not worklist area ?
        updation is not coming, can u plz go throw it..
    Thanks
    Chinna

  • Hardcode the values in the table

    Hiii
    Iam developing a web dynpro application.With out writing the code i can able to deploy and run the application.In that i want to hardcode values in the table for demo purpose.how i can get those values.
    Is there any property in web dynpro to do that,,,,,,,, or else,,,,,,,,, we have to write the code in the application.
    If thats the case,,,,Please provide the code to get the values in the table.
    Regards
    Sushma

    Hi
    For different data,,,,,in what way i have to do.
    Like this your saying
    IPrivateEtrecEmpView.IEmployeeElement element4 = wdContext.nodeEmployee().createEmployeeElement();
                   element4.setDesignation("Software Engineer");
                   element4.setDepartment("Basis");
                   element4.setEmailID("");
                                  element4.setEmpCode("0011579");
                                  element4.setEmpName("");
                                  element4.setMobileNo("");
                                  element4.setSlno("4");
                                  element4.setLocation("Bangalore");
                        wdContext.nodeEmployee().addElement(element4);
         IPrivateEtrecEmpView.IEmployeeElement element3 = wdContext.nodeEmployee().createEmployeeElement();
                             element3.setDesignation("Software Engineer");
                             lement3.setDepartment("Web dynpro");
                             element3.setEmailID("");
                             element3.setEmpCode("0011579");
                             element3.setEmpName("");
                             element3.setMobileNo("");
                                  element3.setSlno("4");
                                  element3.setLocation("Bangalore");
                   wdContext.nodeEmployee().addElement(element3);

Maybe you are looking for

  • Hyperlinks on pictures don't work

    I wanted to put some hyperlinks on pictures that would lead to other pages on my site. When I tried clicking the Insert menu and choosing Hyperlink, the choices were greyed out. Then I tried selecting the picture, and I opened the Inspector and check

  • IRQ problems?, especially with USB.... read this

    Summary: the following things are listed to help people configure or disable USB and USB IRQ related options, some steps may help diagnose/eliminate other IRQ problems. Some Operating Systems/Motherboards may have Similiar or Alternative ways to pref

  • HP Laserjet Pro MFP M12fn, printing a solid black line on every paper

    I'm running windows 7 professional. I haven't received any error messages and nothing out of the oridarny has happened. My printer/scanner/fax/copy (My HP Laserjet Pro MFP M12fn, product # CZ181A) is printing with a black line down the entire paper,

  • Videos app is badly broken

    Has anyone else experienced this? On my home iTunes server, I have about 40 or so seasons of different tv shows.  Maybe 10 of them are from iTunes, but most have been ripped from my DVDs. In previous versions of iOS if I remotely connected to my serv

  • Extra hours being populated in report

    Hi All, I am working on BEx 3.5. In one of my queries I am facing a problem. I have  hours, amount and no of employees in column Hour1 Hour2 Amount No of Employees 20      20      180        1 20      20       0           1 20      20       20