How to display first 5 rows with a specific filter

Hi All,
Please do have a look at the below mentioned query.
select * from emp where empnm like 'B%';Now suppose it will display 10 rows. But I want to display first 5 rows out of them.
How can I do that? I tried this with rownum and rowid. It worked because the records are in order,
but if those records are in arbitrary order, now what? What should be done here?
Regards,
BS2012.

BS2012 wrote:
Hi All,
Please do have a look at the below mentioned query.
select * from emp where empnm like 'B%';Now suppose it will display 10 rows. But I want to display first 5 rows out of them.
How can I do that? I tried this with rownum and rowid. It worked because the records are in order,
but if those records are in arbitrary order, now what? What should be done here?
Regards,
BS2012.This will display the first 5 records no matter of the order
select * from emp where empnm like 'B%'
and rownum <=5;This will display the first 5 records after ordering them
select * from (select * from emp where empnm like 'B%' order by empnm) where rownum <=5 ;Regards.
Al
Edited by: Alberto Faenza on Oct 11, 2012 5:49 PM
Edited by: Alberto Faenza on Oct 11, 2012 5:50 PM

Similar Messages

  • How to display first row value returened from a query as checked as default in a report

    How to display first row value returned from a query as checked as default in a report
    Example
    Parameter 1
    Paramerter2
    ABD
    x(checked)
    Test
    DEF
    JMG
    Mudassar

    Hi Mudassar,
    The issue is caused by the order in which the parameters appear in the report data tab can be difference between our report execution and it failing. In other words, “Parameter2” is execution before parameter “A” due to this issue. We can adjust the parameter’s
    order to solve the issue.
    If “Parameter2” is parameter “A”, we cannot use that expression. Because fields cannot be used in report parameter expression, if we want to display the first value returned from a query as default value, we have to fill the “Specify values” text box with
    the specific value in Default Values dialog box.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to display the message along with a value using BBP_CHECK_BADI

    Hi Gurus,
    I need to display a message dynamically when the user create's a shopping cart. I am using Check_badi for this. i.e., I need to display the buyer number and amount left for him dynamically. I am storing both of them in variables and don't know how to display the messages laong with some message " the amount left for <XXXXXX> is <$$$$$$$$>". Can you help me out.
    Thanks,
    Neelima

    Hi,
    you can use the function module 'BBP_PD_MSG_ADD'. This is the function module normally used for the displaying the error messages in SRM.
    See wether you can use already available error messages , use the transaction SE91 , and the message class being BBP_PD

  • How to display number of rows as columns in a select statement? This is on

    How to display number of rows as columns in a select statement? This is on 10g R2.
    Thanks,
    R

    For the current (ie. row 1 of 100)
    row_number over (order by -pick_a_column_set) as rnfor the total number of columns returned in your query
    count(*) over() as total_count

  • How to display the selection screen with icons as well as with text element

    How to display the selection screen with icons as well as with texts (written in text elements) for PlantDate, OrderType,WareHouse..

    Report zex33.
    type-pools: icon.
    selection-screen begin of line.
    selection-screen comment 1(20) text_001.
    parameters: p_werks type marc-werks.
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(20) text_002.
    parameters: p_whouse(10).
    selection-screen end of line.
    selection-screen begin of line.
    selection-screen comment 1(20) text_003.
    parameters: p_auart like vbak-auart.
    selection-screen end of line.
    initialization.
      write ICON_PLANT  as icon to text_001.
    concatenate text_001 text-001 into text_001 separated by space.
      write ICON_WAREHOUSE  as icon to text_002.
    concatenate text_002 text-002 into text_002 separated by space.
      write ICON_ORDER  as icon to text_003.
    concatenate text_003 text-003 into text_003 separated by space.

  • How to reject external table rows with some blank columns

    How to reject external table rows with some blank columns
    I have an external table and I would like to reject rows when a number of fields are empty. Here are the details.
    CREATE TABLE EXTTAB (
    ID NUMBER(10),
    TSTAMP DATE,
    C1 NUMBER(5,0),
    C2 DATE,
    C3 FLOAT(126)
    ORGANIZATION EXTERNAL (
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY EXT_DAT_DIR
    ACCESS PARAMETERS (
    RECORDS DELIMITED BY NEWLINE
    LOAD WHEN (NOT (c1 = BLANKS AND c2 = BLANKS AND c3 = BLANKS))
    LOGFILE EXT_LOG_DIR:'exttab.log'
    BADFILE EXT_BAD_DIR:'exttab.bad'
    DISCARDFILE EXT_BAD_DIR:'exttab.dsc'
    FIELDS TERMINATED BY "|"
    LRTRIM
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL
    FIELDS (
    ID,
    TSTAMP DATE 'YYYYMMDDHH24MISS',
    C1,
    C2 DATE 'YYYYMMDDHH24MISS',
    C3
    ) LOCATION ('dummy.dat')
    REJECT LIMIT UNLIMITED
    So, as you can see from the LOAD WHEN clause, I'd like to reject rows when C1, C2 and C3 are empty.
    The above statement works fine and creates the table. However when I am trying to load data using it, the following error is produced:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "not": expecting one of: "double-quoted-string, identifier, (, number, single-quoted-string"
    KUP-01007: at line 1 column 41
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    It seems that external tables driver does not understand the "NOT (...)" condition. Could anyone suggest how I can achieve what I want in a different way?
    Thank you.
    Denis

    Another method would be to simply remove the "LOAD WHEN condition" and create a view on the external table which filters the data.
    CREATE EXTTAB_VIEW AS
    SELECT * FROM EXTTAB
    WHERE not (c1 is null and c2 is null and c3 is null);

  • How to display a Math symbol with Subscript(like  "Xad", make the "ad" be Subscript )

    How to display a Math symbol with Subscript(like  "Xad", make the "ad" be Subscript )
    I need to show "Xad"(ad is Subscript )
    I try to find the letter subscript......but ,Unicode set is not have.....
    I try to use  X<sub>ad</sub>   show it  whit Text.htmlText,   but is not used,   I think Flex's HTML is  not support the <sub> mark.
    can you tell me , how to display a Math symbol with Subscript(like  "Xad", make the "ad" be Subscript )
    thank you very much.....

    http://blog.ggshow.com/index.php/how_to_use_subscript_aamp_superscript_in?blog=11
    http://jasonbejot.com/superscript-and-subscript-in-actionscript
    and thank you very very muck

  • How to know the forms associated with a specific transaction

    Hi..
    Can anyone please suggest me how to know the forms associated with a specific transaction.
    For Example In Finance module.
    I came to know from SDN the form associated with F.64 as F140_acc_stat_01.
    But i need the steps how to track the form name.
    Regards..
    Vinodh

    Hi,
    1.We cann't find the forms associated with a specific transaction.
    2.But,based on requirement we can go for the form selection.
    3.Suppose in account payable and receivable , we have different forms like customer statement, Dunning and Chek form etc.
    4.The functional people can find the form name in SPRO and give the details of the requirement.
      5.If u have the output type or formname u can go for the TNAPR and  TTXFP tables and u can search for the respect object.
    6.For FI u can directly find in the SPRO, by searching it with the form name.
    Regards,
    If helpful reward with points(Don't forget).

  • How to delete the selected rows with a condition in alv

    dear all,
    i am using the code in object oriented alv.
    WHEN 'DEL'.
    PERFORM delete_rows.
    FORM delete_rows.
    DATA : lv_rows LIKE lvc_s_row.
    data : wa_ROWs like LVC_S_ROW.
    FREE : gt_rows.
    CALL METHOD alv_grid->get_selected_rows
    IMPORTING
    et_index_rows = gt_rows.
    IF gt_rows[] IS INITIAL.
    MESSAGE s000 WITH text-046.
    EXIT.
    ENDIF.
    loop at gt_rows into wa_ROWs .
    if sy-tabix ne 1.
    wa_ROWs-INDEX = wa_ROWs-INDEX - ( sy-tabix - 1 ).
    endif.
    delete gt_sim INDEX wa_ROWs-INDEX .
    endloop.
    the rows to be deleted from int.tab gt_sim not in the alv display.
    all the rows should not be deleted if one of the field in gt_sim eq 'R'.
    how to check this condition

    dear jayanthi,
            ok if i am coding like that as u mentioned ,
              it will exit the loop when first time the field value is 'R'.
      if any of  the selected rows contains  field value 'R'. it shold not delete all the selected rows.
    as u suggested it will not delete after first time the field value is r.
    i am deleting it by tab index so,
    suppose if i am selecting the row without field value R say its tabix is 1.
      the next row with tabix 2 with field value R.
      it deletes the first row and exits , it should not delete the first row also.

  • How to: Display Last n Rows in a table

    I am currently running Crystal Reports XI and have been tasked with developing a report that displays only the last 30 rows in a table in ascending order (the records are used for showing data trends over time in a line graph). I have created a Command to extract the records, and by using the TOP 30 statement I can get the first 30 rows in proper order; however, in order to get the last 30 rows I have to sort the records in descending order. This gives me the last 30 rows that I need, but the data is in descending order. Is there another way to get the last 30 rows in a table so that the records come out in ascending order?
    The Command I am using looks like this:
    SELECT TOP 30 ROWID FROM MYTABLE ORDER BY ROWID DESC
    (The ROWID field is alpha numeric)

    Hi,
    Create a Group based on Rowid in the order-Ascending. This Group should contain all the fields that you require to print along with Rowid.  Therafter insert Summary like sum,count etc for for any field within the group of the type numbervar(numeric). This would activate the Group Sort Expert in the Report Menu. Click on it and select Bottom N (with N as 30) within nature of Sort and suppy the fieldname as Rowid.
    Hope this solves.....
    Thanks,
    Amogh.

  • How to handle the current row with radio button selection???

    Hi Everyone,
    I have one ADF page with one table and one "Find" button.
    I have created one new attribute with VARCHAR2(1) in the VO and dragged that attribute as first column in the table. And changed that first column to Radio Button to select only one row at a time.
    Upon clicking on the "Find" button i need to get the values of current selected row.
    How can i get the values of selected row?
    What code should i write to get the values of selected row in Method Binding of "Find" button?
    Any suggestions will be really useful.
    Thanks.

    Hello Kumar,
    I have some comments on your case.
    >
    I have created one new attribute with VARCHAR2(1) in the VO
    >
    1- You should create this attribute in the Entity object and then add it to the view object.
    2- Do you need that only one radio button is set at a time for all rows ? If yes then you need to handle the case when the user set more than one row and clear the value of the attribute for all other rows.
    >
    How can i get all the values of current row in backing bean method(method binding of Find method)?
    can u plz provide me the code for that?
    >
    If you mean by the current row is that the row with its value of the selected attribute is set (the radio button is set for that row), then you can write a method in the viewObjectImpl class and expose it to client interface and call it from your bean.
    here is an example based in Department table in HR schema.
    //This method is written in DepartmentsViewImpl   
    public Row getSelectedRadioRow(){
                //create a second row set to not impact the row set used in ADF
                RowSet duplicateRowSet = this.createRowSet("duplicateRowSet");
                //get the current row of the table to set it back after re-executing the VO
                DepartmentsViewRowImpl currentRow = (DepartmentsViewRowImpl)this.getCurrentRow();
                Row[] filteredRows = duplicateRowSet.getFilteredRows("IsSelected", "1");
                DepartmentsViewRowImpl row=null;
                if(filteredRows.length>0){
                    row = (DepartmentsViewRowImpl)filteredRows[0];
                    System.out.println("Department Name " + row.getDepartmentName());              
                this.setCurrentRow(currentRow);
                duplicateRowSet.closeRowSet();
                return row;           
            }

  • Return first n rows with skip locked.

    Timesten is used from Java using client-server access. We have to replicate rows from TimesTen to another database.
    We have parallel job processing rows. While processing, rows are locked:
    SELECT FIRST N * FROM TABLE_X FOR UPDATE
    The problem is that the first job selects and locks first n rows and other job have to wait until locks are released. Is it possible to skip locked rows, so other jobs would select another set of rows.
    With Oracle this can be accomplished using SKIP LOCKED clause. With SQL Server using WHERE Locked IS NULL clause.
    Is possible to have this kind of behavior in TimesTen?
    Is there some other alternative for replicating rows? XLA API seems to be for this, but it seems a little bit complicated and we have to use direct-access, which is not suitable for our setup.
    Thanks

    Unfortunately, TimesTen does not have any option to skip locked rows. I'm guessing that the 'other database' isn't Oracle? If it is you could use an AWT cache group. XLA (or JMS/XLA for Java) is really the best option for 'replicating' in terms of performance etc. It is true that to use it the component that does the 'replication' would have to run on the machine where TimesTen is running but the rest of the app would not have to do so. Mind you direct mode does give much better performance :-)
    If you really need to do this through SQL then you'll have to figure out a way to get the different jobs to look at different sets of rows without locking them. Exactly how you might do this of course depends a lot on the application and exactly what it is trying to do. One approach would be to have a column in the table to identify which 'replicator' is currently processing the row. You could use NULL to mean it is not being processed and some id value (could just be a number) to indicate that replicator 1 (or 2 or 3 or ...) is processing it. Replicator 'n' would 'reserve' a set of rows by updating he column to 'n' and committing. Then it would do its work and afterwards update the column again to some other value that means 'replication done'. This may work okay or may not depending on what else the application needs to do concurrently with those rows etc.
    Chris

  • How to create the new row with existing values

    Hi all,
    first of all i create a row,
    i opened that in edit mode,
    suppose i want to edit any one of the value in that recordd,
    that time compulsory create a new row with those valuess.
    how can i create a new row with those valuess.

    Hi Anusha,
    This code correct for your requirement, only thing is you are not able to modify it as per your requirement.
    What you have to do is:
    1. Copy queried row into into new row, change primary key values(but don't commit your changes here).
    2. Now you have two rows in your VO(OLD as well as New)
    3. Make any changes if you want using User Interface.
    4. At the save button first compare OLD and NEW row, if any value is differing then commit the chnages(it will insert new row in corresponding database table), if no changes are there I mean to say OLD value and NEW rows are same then rollback(it will remove copied row from VO and no row will be inserted in database.)
    While comparing rows please note that Primary keys will not be same so don't compare Primary keys while comparing rows.
    I hope it will help you.
    Regards,
    Reetesh Sharma

  • How to display multiple selected rows in a table inside a popup?

    Hi,
    I have a table on which multiple selection is enabled. I am able to get hold of multiple selected rows i.e. i am able to iterate over the selected row keys and print their values. Now, my problem is how to display the contents of all the selected rows in a popup? I get the details of only one row when I launch the popup.
    Thanks
    Karan

    Hi,
    Not confident if this works or not but just try it...
    1. create a ViewLink between the same view Object.
    The source and destination wil be the same Vo and the source and destination attribute will be the pk of both Vos.
    2. Update the changes in Appln Module.
    Open the AM and in DataModel tab .
    select the Same VO from which you created table in the DataModel Listbox and select the VL in the "Avaible View Objects" List Box. Add under it(selected vo in datamodel listbox).
    3. Refresh DataControl accordion.
    4. in your jsff page drag and drop the child vo as a table..
    See if it works
    Regards,
    Santosh.

  • Report Painter - how to insert sub header rows with no values

    In a report painter, I am designing a report with several rows with formulas. I need to insert a sub-header row in the middle of the rows. That will not have a value. It shall contain no value, but I am given only options of either insert a row of characteristics or a formula. I need neither of them. Can we have something excel  like feature in report painter (4.6c) just to insert a sub header row? If so how do we get that.
    e.g
    ADMINISTRATIVE EXPENSES (how to insert this row?)
    Account 1 - 10

    Hi,
    try to add a formular row containing a formular like = +x -x.
    Maybe you can use "formatting / row" and use overscores / underscores to get a blank row (underscore one line, overscore the line thats following).
    No other idea...
    best regards, Christian

Maybe you are looking for

  • SecondaryMultiKeyCreator bug still there?

    Hi, I am using the java api for the Berkeley DB, and I ran into trouble using a BTREE to secondary index a RECNO primary database. After searching the forum, it seems like this was fixed here: http://forums.oracle.com/forums/thread.jspa;jsessionid=8d

  • Refiner TEst is different on ACtual Search Results

    WHen I do Test on Refiner Webpart, it generate two Result with two refiner. But after Clicking OK and SAVE it only generate One Search Result and one refiner. I already did lots of FULL CRAWL and IISRESET and SharePoint Timer SErvice Restart but noth

  • FCP HD 4.5 footage freezes during capture

    Hello Here we go again! I just upgraded to Tiger 10.4.9 and QT 7.1.6 and I'm having issues with capturing footage. Basically the video in Log and Capture window freezes for 2-5 seconds periodically while capturing, so it skips and when I playback the

  • I have a MacBook4,1, Lion IOS 10.7.5. Why I can't install Mountain Lion? Thank you

    I would like to install the Mountain Lion IOS im my MacBook4,1, but when I update my software I receive the mensage thal is not possible. Why?

  • Scratch Disks full error in Photoshop - 107 Gigs of space on hard drive

    I am trying to edit pictures under a dead line. I have used this computer a few times to edit pictures with no problems, now that I it is work and I have a dead line...there are problems. I have dealt with scratch disk problems before and it was alwa