Display the 3rd hieghest value without using rowid

HI All,
Can any one help me how to display the 3rd hieghest valuer without using a ROWID..
Thanks
Basava

Frank, using ROWNUM = 1 instead of DISTINCT could be a bit faster:
SQL> SET LINESIZE 132
SQL> EXPLAIN PLAN FOR
  2  WITH got_r_num AS (
  3                     SELECT  DISTINCT sal,
  4                                      DENSE_RANK() OVER(ORDER BY sal DESC NULLS LAST) AS r_num
  5                       FROM  scott.emp
  6                    )
  7  SELECT  sal
  8    FROM  got_r_num
  9    WHERE r_num = 3
10  /
Explained.
SQL> @?\RDBMS\ADMIN\UTLXPLS
PLAN_TABLE_OUTPUT
Plan hash value: 436395657
| Id  | Operation                 | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT          |      |     9 |   234 |     5  (40)| 00:00:01 |
|*  1 |  VIEW                     |      |     9 |   234 |     5  (40)| 00:00:01 |
|   2 |   HASH UNIQUE             |      |     9 |    36 |     5  (40)| 00:00:01 |
|*  3 |    WINDOW SORT PUSHED RANK|      |     9 |    36 |     5  (40)| 00:00:01 |
|   4 |     TABLE ACCESS FULL     | EMP  |    14 |    56 |     3   (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
   1 - filter("R_NUM"=3)
   3 - filter(DENSE_RANK() OVER ( ORDER BY INTERNAL_FUNCTION("SAL") DESC
              NULLS LAST)<=3)
18 rows selected.
SQL> EXPLAIN PLAN FOR
  2  WITH got_r_num AS (
  3                     SELECT  sal,
  4                             DENSE_RANK() OVER(ORDER BY sal DESC NULLS LAST) AS r_num
  5                       FROM  scott.emp
  6                    )
  7  SELECT  sal
  8    FROM  got_r_num
  9    WHERE r_num = 3
10      AND ROWNUM = 1
11  /
Explained.
SQL> @?\RDBMS\ADMIN\UTLXPLS
PLAN_TABLE_OUTPUT
Plan hash value: 21859616
| Id  | Operation                 | Name | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT          |      |     1 |    26 |     4  (25)| 00:00:01 |
|*  1 |  COUNT STOPKEY            |      |       |       |            |          |
|*  2 |   VIEW                    |      |    14 |   364 |     4  (25)| 00:00:01 |
|*  3 |    WINDOW SORT PUSHED RANK|      |    14 |    56 |     4  (25)| 00:00:01 |
|   4 |     TABLE ACCESS FULL     | EMP  |    14 |    56 |     3   (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
   1 - filter(ROWNUM=1)
   2 - filter("R_NUM"=3)
   3 - filter(DENSE_RANK() OVER ( ORDER BY INTERNAL_FUNCTION("SAL") DESC
              NULLS LAST)<=3)
19 rows selected.
SQL> SY.

Similar Messages

  • How to display the output screen when I use bdc.

    hey expert,
    I want to display the output screen when i use bdc without using mode 'A'.
    thank you.

    Hi,
    You can go for mode 'E'.. it will display the output screen directly and if there is any error in the transaction you would get that particular screen and you can correct and continue after which you will get the final screen if anything goes fine...
    check this sample code....
    I had a program if you execute below program it automatically creates a new zprogram.
    REPORT  zprogram_create_recording.
    PARAMETER:
      p_prog    TYPE sy-repid OBLIGATORY,
      p_shtxt TYPE repti OBLIGATORY,
      p_pack  TYPE devclass DEFAULT '$tmp'.
    DATA:
      t_bdcdata LIKE
       STANDARD TABLE
             OF bdcdata.
    DATA:
      wa_bdcdata LIKE LINE OF t_bdcdata.
    REFRESH t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-program    =  'SAPLWBABAP'.
    wa_bdcdata-dynpro     =  '0100'.
    wa_bdcdata-dynbegin   =  'X'.
    wa_bdcdata-fnam       =  'RS38M-PROGRAMM'.
    wa_bdcdata-fval       =  p_prog.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam       =  'BDC_OKCODE'.
    wa_bdcdata-fval       =  'NEW'.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-program    =  'SAPLSEDTATTR'.
    wa_bdcdata-dynpro     =  '0200'.
    wa_bdcdata-dynbegin   =  'X'.
    wa_bdcdata-fnam       =  'RS38M-REPTI'.
    wa_bdcdata-fval       =  p_shtxt.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam       =  'TRDIR-SUBC'.
    wa_bdcdata-fval       =  '1'.
    APPEND wa_bdcdata TO t_bdcdata.
    CLEAR wa_bdcdata.
    wa_bdcdata-fnam       =  'BDC_OKCODE'.
    wa_bdcdata-fval       =  'CONT'.
    APPEND wa_bdcdata TO t_bdcdata.
    IF p_pack EQ '$TMP'.
    *local object
      CLEAR wa_bdcdata.
      wa_bdcdata-program    =  'SAPLSTRD'.
      wa_bdcdata-dynpro     =  '0100'.
      wa_bdcdata-dynbegin   =  'X'.
      wa_bdcdata-fnam       =  'KO007-L_DEVCLASS'.
      wa_bdcdata-fval       =  ' '.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'BDC_OKCODE'.
      wa_bdcdata-fval       =  'TEMP'.
      APPEND wa_bdcdata TO t_bdcdata.
    ELSE.
    *package assignment with request
      CLEAR wa_bdcdata.
      wa_bdcdata-program    =  'SAPLSTRD'.
      wa_bdcdata-dynpro     =  '0100'.
      wa_bdcdata-dynbegin   =  'X'.
      wa_bdcdata-fnam       =  'KO007-L_DEVCLASS'.
      wa_bdcdata-fval       =  p_pack.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'BDC_OKCODE'.
      wa_bdcdata-fval       =  'ADD'.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-program    =  'SAPLSTRD'.
      wa_bdcdata-dynpro     =  '0300'.
      wa_bdcdata-dynbegin   =  'X'.
      wa_bdcdata-fnam       =  'KO008-TRKORR'.
      wa_bdcdata-fval       =  ' '.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'KO008-AS4TEXT'.
      wa_bdcdata-fval       =  ' '.
      APPEND wa_bdcdata TO t_bdcdata.
      CLEAR wa_bdcdata.
      wa_bdcdata-fnam       =  'BDC_OKCODE'.
      wa_bdcdata-fval       =  'LOCK'.
      APPEND wa_bdcdata TO t_bdcdata.
    ENDIF.                                 " IF P_PACK EQ '$TMP'
    CALL TRANSACTION 'SE38' USING t_bdcdata MODE 'E'.
    Hope this would help you..
    Regards
    Narin Nandivada

  • Need to display the first 5 values of a Multi value parameter in SSRS report

    Hi All,
    I have SSRS report with multi value parameter. I need to display the parameter selection values in a text box. I've more than 50 records in the multi value parameter list. I've included the code to display "All" if I choose "select
    all" option otherwise it will show the selected values. But, I need to change the logic. I have to show only the 1st 5 records if I choose more than 5 records.
    How can I implement this?
    I have used the below code
    =iif(
    Parameters!Country.Count = Count(Fields!Country.Value,
    "Country")
    ,"All"
    ,iif(Parameters!Country.Count>5
    ,"Display the 1st 5 values"
    ,Join(Parameters!Country.Value,",")
    Regards,
    Julie

    Hi Julie,
    Per my understanding that you want to always show the first values from the param country to a textbox when you have select more then five values from the dropdown list, if you checked "select all", textbox will display "All", if
    you select <=5 amount of values. it will display the selected values, right?
    I have tested on my local environment and that you can create an hide parameter(Param2) to display just the first five values from the Country and when you select more then five values from country you will get the Join(Parameters!Param2.Value,",")
    to display.
    Details information below for your reference:
    Create an new DataSet2 which the Param2 will get the values from:
    SELECT     TOP (5) Country
    FROM        tablename
    Create an new param2 and hide this parameter, Set the "Available values" and "Default values" by select the "Get the values from a query"(DataSet2)
    You can also Specify first five value for the "Available values" and "Default values", thus you will not need to follow the step1 to create the dataset2
    Modify the expression you have provided as below:
    =iif(Parameters!Country.Count = Count(Fields!Country.Value, "DataSet1"),"All" ,iif(Parameters!Country.Count>5 ,Join(Parameters!Param2.Value,","),Join(Parameters!Country.Value,",")))
    Preview like below
    If you still have any problem, please feel free to ask.
    Thanks, 
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • Display the arabic total value in reuse_alv_grid_display

    Hi,
    how to display the arabic total value using reuse_alv_grid_display in sap abap . Plz help me in this matter.
    Regards,
    SA.

    Hi,
    how to display the arabic total value using reuse_alv_grid_display in sap abap . Plz help me in this matter.
    Regards,
    SA.

  • How to Delete duplicates rows without using rowid/distinct.

    How to delete duplicates rows present in a table without using rowid or even distinct.

    How about:
    SQL> SELECT * FROM t1;
             A          B
             1          2
             2          3
             1          2
             4          4
             4          4
             4          4
    SQL> DELETE FROM t1
      2  WHERE (a, b) IN (SELECT a, b FROM t1
      3                   GROUP BY a, b
      4                   HAVING COUNT(*) > 1) and
      5        rownum = 1;
    1 row deleted.
    SQL> /
    1 row deleted.
    SQL> /
    1 row deleted.
    SQL> /
    0 rows deleted.
    SQL> SELECT * FROM t1;
             A          B
             2          3
             1          2
             4          4Although, if I was asked a similar question with all those restrictions, my first response would be along the lines of: Is this question indicative of the way I will have to work if I join this company? If so, there is no point answering because I wouldn't touch this job with a ten foot pole.

  • Is there any way to wait for a value without using JDialog or JOptionPane?

    I am implementing a dictionary program by detecting word in a JTextPane and asking a user to choose one of available meanings from JOptionPane or JDialog. The program runs under a while-loop until all dictionary words are detected or a user clicks cancel.
    However, I don't want to use JDialog or JOptionPane because it is sometimes annoying to have a popup window on every detected dictionary word.
    So, I use JList with Buttons on the same Frame as the JTextPane. However, now, the program does not stop when it detects a dictionary word. It just uses a default value of the JList for translating word to meaning.
    Is there any way I can simulate the JDialog or JOptionPane without using it?
    I mean I'd like to stopp the program temporary, wait for an answer from other components, and then continue to detect the next dictionary word.
    Thank you.

    I'm probably reading this all wrong, but instead of the while loop,
    the method just looked for a dictionary word from a particular caretPosition,
    so, to start, it would be findWord(0)
    when found, add whatever to wherever, note the caretPostion at the end of the 'found' word, and method returns.
    when the user selects whatever button, the button's actionListener also calls the method again, using the noted caretPosition
    findWord(42);
    so, it starts searching from 42 (instead of the start)
    basically it is event driven
    findWord sets the button/s
    click a button starts findWord

  • How to display the output of report(9i) using Report Background Engine

    Hi,
    We are converting the forms and reports from 6i to 9i.
    we could run the report in the browser from form using WEB.SHOW_DOCUMENT built-in, but we are not able to display the report output from form using the Report Background Engine.Let us know if you have any solution for this.
    Regards,
    Pramila.

    Pramila,
    you have to use Reports Server called from RUN_REPORT_OBJECT(). Please see the Reports Integration whitepaper on otn.oracle.com/products/forms. You can either look it up in the Forms 10g collateral seciton or the Forms 9i collateral section.
    Frank

  • Count the no.of rows without using count function

    Hi,
    How to count the no.of rows without using the count function?
    Thanks,

    they won't be 100% accurate. You're correct, Bluefrog, but the same goes for doing a count(*) (depending on the size of the table, ofcourse):
    the table being queried might be under DML (deletes/inserts), and the next count(*) might give different results.
    Both approaches will never be 100% accurate.
    But simply selecting num_rows will be much much faster than doing a count(*).
    Counting the number of rows always reminds me of this ongoing discussion, by the way:
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:127412348064#14136093079164 ;)
    Usually knowing the number of records by approximatly is sufficient, imo. 1000000 or 1000007 records: I don't care, don't need to know that.
    I've never needed to know the exact number of records in a table in my code, or been given a requirement that forced me to.

  • Manually set up the essbase 11 client (without using the fusion installer)

    Hi All,
    is it possible to install the Essbase 11 client without using the Fusion Installer?
    I tryed to copy the "bin" and "locale" directory from an exisiting installation and set up the ARBORPATH environment variable - without success.
    Did I miss anything? Maybe some Registry entries? Or isn't it possible to set up the essbase client manually?
    Every answer would be appreciated.
    Cheers,
    Martin

    Hi John,
    thanks for the hint that the addin is also available for any version.
    I have an application which uses the C-API (essapinu.dll, essotlnu.dll, ...) and I want to test it with diffrent Essbase Client Versions against diffrent Essbase Servers.
    These are the (client) versions which I want to test:
    EssbaseRtc11110WindowsFiles
    EssbaseRtc11111WindowsFiles
    EssbaseRtc11112WindowsFiles
    EssbaseRtc11113WindowsFiles
    EssbaseRtc9203WindowsFiles
    EssbaseRtc9210WindowsFiles
    EssbaseRtc9301WindowsFiles
    EssbaseRtc9310WindowsFiles
    I hoped it would be enough to replace some directorys on a machine instead of starting a lot of installers.
    Cheers,
    Martin

  • I want to configure the 7330 motion controller without using MAX

    I am new to labview and I have a project where I have to configure the 7330 motion controller without using MAX. What do I need to do to get started doing so?
    Thanks for the help!
    nw2labview

    Hi,
    There are several VI's that are included with the motion driver for configuring your controller.  They are located on the function pallete under Vision and Motion>>Ni-Motion>>Axis Configuration.  Using these VI's you will be able to configure your axis.  But why don't you want to use MAX?  If you are new to LabVIEW I would suggest configuring and testing your motor in MAX first before you start programing.  Once you have it working there you may want to look at several of the examples such as Simple One-Axis Move.vi.  I hope this helps.
    GG

  • How to extract the mouse cursor image without using JNI

    I want to get the image of the mouse cursor of the system using java. The Robot class captures the screen only, but the mouse icon image is not the part of the screen, so it is not easily detected. But we can get the mouse cursor position using API, but how to get the exact image icon, without using JNI. I don't want to generate my own cursor at that position.

    I am building a Remote Desktop kinda app using java..... I want the screen of the remote comp to be viewed on my screen and generate events from my machine to the remote machine. So, I am capturing the screen images of the remote machine. But the cursor is not part of the screen object. i want to extract the cursor image icon from the remote machine to my machine and render the image.

  • How can you trim the contact field value without cloudconnector?

    How can you trim the contact field value without cloudconnector?

    You can add your contacts to segments, while right-clicking on the criteria you have added in segments, you will see the option for Merge, Intersect & Trim.
    See the attached URL, it might help you .
    Merge, Intersect, Trim

  • HT2204 I have recently immigrated to the US but my apple ID is still stuck with my previous country. How do I change the country? Preferably without using a credit card

    I have recently immigrated to the US but my apple ID is still stuck with my previous country. How do I change the country? Preferably without using a credit cardI've only been here in the US 2 months and still have no US credit card.

    Your credit or debit card credentials must be associated with the same country where you reside.
    "Although you can browse the iTunes Store in any country without being signed in, you can only purchase content from the iTunes Store for your own country. This is enforced via the billing address associated with your credit card or other payment method that you use with the iTunes Store, rather than your actual geographic location."
    From here >  The Complete Guide to Using the iTunes Store | iLounge Article

  • Need to take rownum highest value without using grouping functions

    Hi
    I want to display highest value in the rownum column and customer details without using grouping functions like max or count
    this below query gives me all rownum values and customer details
    SELECT ROWNUM ROWNUM_1, CUSTOMER_NO, CUSTOMER_NAME, CUSTOMER_DOJ, CUSTOMER_MOBILENO FROM CUSTOMER;
    can any one help me.

    The above query won't work as it's missing "from" cluase in the inner select statement.
    And even if corrected it willl print rownum values thrice: value "1",max_rownum, max_rownum followed by customer details.
    Below is the simple query to retrieve max row_num along with the corresponding customer details.
    select * from (SELECT ROWNUM ROWNUM_1, CUSTOMER_NO, CUSTOMER_NAME, CUSTOMER_DOJ, CUSTOMER_MOBILENO FROM CUSTOMER order by rownum_1 desc) where rownum<=1 ;

  • How to display the current day value in Numbers app?

    In Numbers 3.2.2, where the current date and time happens to be 17 Dec. 2014 11:46am:
    What formula will display the current date's numeral value?
    What formula will display the current month's short name as text?
    What formula will display the current year in four digits?
    What formula will display the current time in the style "11:46am"?
    Appreciated.

    I've taken the liberty of tweaking that handy script to format the date as requested by the OP:
    on run {}
      set right_now to (current date)
      set short_month to text 1 thru 3 of (month of right_now as string)
      set the_year to year of right_now as string
      set the_day to day of right_now as string
      set short_time to text 1 thru 5 of time string of right_now
      set the_secs to time of right_now
      if (the_secs / 2 as integer) < 21600 then
      set am_pm to "am"
      else
      set am_pm to "pm"
      end if
      set s to space
      set text_date to the_day & s & short_month & ". " & the_year & s & short_time & am_pm
      set the clipboard to text_date
      my paste_date()
    end run
    on paste_date()
      tell application "Numbers"
      activate
      tell application "System Events"
      keystroke "v" using {command down}
      end tell
      end tell
    end paste_date
    This considers 11:59:59 to be "am" and 12:00:00 to be "pm". (Edited after further consideration.) It has to be run either as an Automator service, or saved in ~/Library/Scripts/Applications/Numbers/ and run from Numbers' script menu. If run from Script Editor, it pastes the date into the end of the script itself.
    Hope it helps,
    H

Maybe you are looking for

  • ICloud mail not syncing with Droid RAZR

    On July 24th, 2012 iCloud mail stopped syncronizing with my Droid RAZR.  My wife and I have identical phones, and have currently active and functional iCloud accounts on Mac. Both of our phones had functional email syncronization before AND AFTER ICS

  • Itunes 7 + Win XP Pro (Recover from a serious error0

    Everytime i turn on my PC I get this window telling me that windows has recovered from a serious error. The last blue screen I got was almost a week ago. I have done system retore to pre iTunes 7 and i continue to get this error. iTunes 7 is the only

  • Navigate to Universal work list in portal (UWL)

    Hi Experts, I need to navigate to the UWL from my component on click of a button. For this should we just call the URL (hardcoded) on the button event or should we navigate to the Iview in which the UWL is embeded. Please advice. Thanks in Advance, C

  • Including hidden items in File Export?

    Gday, It seems not that I have my export button working I am having issues with exporting hidden columns? I have the PLSQL Expression set to apex_application.g_excel_format = TRUE but the columns still aren't showing up in the export? The odd thing i

  • Function Keys on a Mac

    I've already got a thread going on this for the Apple Java list, but: Does anybody know of a way to make a Mac deliver function keys as KeyEvents, rather than intercepting them? JHHL